这是我的数据示例,列中有多种类型。
df = pd.DataFrame({'A':['01/03/1987', 'May-1', 'Jan-08', '10-Feb', '2/13/2016','2-13-2016', 99.98, 'a text', 'text00', 10, -9, 4-5]})我想我已经列出了日期的所有格式。如果可以使用regexp,如何从列中删除日期?
结果:
df = pd.DataFrame({'A':[99.98, 'a text', 'text00', 10, -9, 4-5]})发布于 2021-08-03 16:17:28
如果您有不同的日期格式,那么一个简单的str.contains就可以了
con = df['A'].str.contains('/|-')
df[(con.isna()) | (con==False)] A
6 99.98
7 a text
8 text
9 10https://stackoverflow.com/questions/68639362
复制相似问题