根据最后一个字符从df中删除字符串(行)

时间:2019-11-08 13:10:29

标签: python pandas dataframe

我有一个包含时空的df

0                 NaN
1           2:09.889P
2     00:01:58.108000
3     00:02:06.386000
4     00:01:59.144000
5     00:01:58.321000
6     00:01:59.519000
7     00:01:59.183000
8     00:01:58.889000
9                 NaN

我希望能够删除字符串末尾带有Char'P'的所有实例。 数据来自Excel文件。 数据框

Laptime_1 = df1[laptime_1]

Laptime_1 = df1.drop(df1[laptime_1.str.contains('P')].index,inplace=True)

Laptime_1 = df1[laptime_1]

0 个答案:

没有答案