Pandas add one day to column

后端 未结 6 1873
情歌与酒
情歌与酒 2020-12-24 05:10

I need to add 1 day to each date I want to get the begining date of the following month eg 2014-01-2014 for the 1st item in the dataframe. Tried:

montdist[\         


        
6条回答
  •  渐次进展
    2020-12-24 05:41

    No need to turn into an index. Just using .apply() works:

    df['newdate'] = pd.to_datetime(df['date']).apply(pd.DateOffset(1))
    

提交回复
热议问题