i not know why snippet producing 01/01/1970 dates when sure not accurate.
my original file:
appreciation start funding date 41266 41432 41266 41715 41266 41533 41266 41505 41266 41444 41550 41513 41550 41451
my snippet:
import pandas pd df['funding date'] = pd.to_datetime(df['funding date']).apply(lambda x: x.strftime('%m/%d/%y')if not pd.isnull(x) else '') df['appreciation start'] = pd.to_datetime(df['appreciation start']).apply(lambda x: x.strftime('%m/%d/%y')if not pd.isnull(x) else '') df.to_excel('new.xlsx')
in excel:
appreciation start funding date 01/01/1970 01/01/1970 01/01/1970 01/01/1970 01/01/1970 01/01/1970 .......... ..............
how can fix this?
pandas not able decipher 41266 date. can add preceding 0 date looks 041266. use pd.to_datetime
df['appreciation'] = '0'+df['appreciation'].astype(str) df['appreciation'] = pd.to_datetime(df['appreciation'], format = '%m%d%y')
Comments
Post a Comment