I am wondering if there are any efficient methods or one-liner that, given a pandas DatetimeIndex date1, return a DatetimeIndex date2 that is the first day of the next month?
For example, if date1 is '2011-09-30' then date2 is '2011-10-01'?
I have tried this one liner
df.index.to_period("M").to_timestamp('M')
But this seems only able to return the "last day of the same month". Is it possible to do some datetime arithmetic here?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…