【发布时间】:2021-05-26 12:21:55
【问题描述】:
我有一些列名在不同的空格处包含两个问号,例如'你那时候几岁?你什么时候开始上大学的? - 我需要确定哪些列中有两个问号。欢迎任何提示!谢谢
数据
df = pd.DataFrame(data={'id': [1, 2, 3, 4, 5], 'how old were you? when you started university?': [1,2,3,4,5], 'how old were you when you finished university?': [1,2,3,4,5], 'at what age? did you start your first job?': [1,2,3,4,5]})
预期输出
df1 = pd.DataFrame(data={'id': [1, 2, 3, 4, 5], 'how old were you when you finished university?': [1,2,3,4,5]})
【问题讨论】:
标签: python pandas duplicates columnname drop