【发布时间】:2021-05-30 13:05:29
【问题描述】:
我有一个如下所示的数据框:
Film Description
0 Batman Viewed in 2021-10-04T14:30:31Z City Hall, London
1 Superman Aired 2012-01-04R11:01:10Z in the USA first
2 Hulk 2010-07-04S07:22:02Z Still being produced
我想从“描述”列中的每一行中删除日期时间,如下所示:
Film Description
0 Batman Viewed in City Hall, London
1 Superman Aired in the USA first
2 Hulk Still being produced
我已经尝试过这个字符串正则表达式:
df['Description'] = df['Description '].str.replace(r'\^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})Z', '')
【问题讨论】:
标签: python regex pandas dataframe data-cleaning