Closed
Description
Pandas version checks
- I have checked that the issue still exists on the latest versions of the docs on
main
here
Location of the documentation
Documentation problem
The docs for MonthEnd say
To get the end of the current month pass the parameter n equals 0.
This is correct:
In [51]: pd.Timestamp('2023-03-21') + pd.offsets.MonthEnd(n=0)
Out[51]: Timestamp('2023-03-31 00:00:00')
But for `MonthBegin, it says
To get the start of the current month pass the parameter n equals 0.
I think this is not quite right:
In [58]: pd.Timestamp('2023-03-21') + pd.offsets.MonthBegin(n=0)
Out[58]: Timestamp('2023-04-01 00:00:00')
Suggested fix for documentation
I would have expected - pd.offsets.MonthBegin(n=0)
to go to the beginning of the current month, but it doesn't:
In [64]: pd.Timestamp('2023-03-21') - pd.offsets.MonthBegin(n=0)
Out[64]: Timestamp('2023-04-01 00:00:00')
I'm not sure if this is a bug, I've not looked closely enough.
I think I'd suggest:
- removing the "To get the start of the current month pass the parameter n equals 0." suggestion
- adding an example of using
+ pd.offsets.MonthBegin() - pd.offsets.MonthBegin()
to get the start of the current month
cc @natmokval in case you wanted to make a PR (no blame of course! I should have noticed this when reviewing)