Reputation: 17631
I have a Pandas Dataframe df
with lists the Year, Month, and Day separately, with all days of the year. The following is a sample for December:
Year Month Day
1995 12 14
1995 12 15
1995 12 15
1995 12 16
1995 12 17
And I wanted to create a timestamp with this data. So, I try this:
df['Datetime'] = pd.to_datetime(df.Year*10000 + df.Month*100 + df.Day, format="%Y%M%d")
Unfortunately, all of the months are listed as January. The following is outputted as this:
1995-01-14 00:01:00
1995-01-15 00:01:00
1995-01-15 00:01:00
1995-01-16 00:01:00
1995-01-17 00:01:00
What is my error above?
Upvotes: 0
Views: 968