strftime('%y-%m-%d')与dt.date

strftime(’%y-%m-%d’)、dt.date都可以将2020-02-02 14:01:01转化为2020-02-02,但如果有Nan值strftime(’%y-%m-%d’)将报错,dt.date不会报错。

data1['createTime']=data1['createTime'].apply(lambda x:x.strftime( '%Y-%m-%d' ))
data1['unsubTime']=data1['unsubTime'].dt.date

参考文章:https://blog.csdn.net/huangguohui_123/article/details/103528573

你可能感兴趣的:(数据处理)