如何从列中完全删除一个元素?

时间:2019-03-26 17:44:25

标签: pandas dataframe strip

我有此专栏:

Mi_Meteo['Time_Instant']:


0        2013/11/14 17:00
1        2013/11/14 18:00
2        2013/11/14 19:00
.
.
.

当我查看它的值时,这就是我发现的内容:

Mi_Meteo['Time_Instant'].value_counts():

2013/12/10 16:00    33
2013/12/11 19:00    33
2013/12/09 17:00    33
.
.
.
DateTIme             3

我想摆脱那个“ DateTIme”,因为否则我无法将列转换为日期时间。

任何建议,不胜感激,谢谢。

1 个答案:

答案 0 :(得分:0)

我提出了这样的解决方案:

df['time']=np.where((df['time'].str.contains('DateTIme')),np.nan,df['time'])
df.time.dropna(how='all').to_frame()
相关问题