日期字符串转日期
pd.to_datetime
判断字符串是否是日期字符串
def canbe_date(x:str= "0"):
if (type(x)!= str) or x== "": # if (x in [None, "", pd.NaT]) or (type(x)!= str)
return False
try:
pd.to_datetime(x, format= "%Y-%m-%d")
return True
except:
return False
标签:文件,return,pd,datetime,修改,日期,str,字符串
From: https://blog.51cto.com/u_16055028/7240990