Issue
I have a dataframe that contains 3 columns year month and SPEI value
I want to add day column that contains the first day of each month
Solution
If need new column with first day
use:
df['day'] = 1
If need datetime with first day:
df['datetime'] = pd.to_datetime(df[['year','month']].assign(day=1))
Answered By - jezrael
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.