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[\
As far as I can tell tshift
is a bit faster than doing math such as + pd.DateOffset
etc. Of course it only applies to Series or Dataframe indices, not columns.. but you could do:
df['newdate'] = pd.Series(index=df.index).tshift(periods=1, freq='D').index
If your df is large, this may shave off half the time - at least it did for me, which is why I'm using it.