BUG: Breaking change to offsets.pyx - MonthOffset
State: closed

Add ability to use class `MonthBegin` as a period.
It would address #38914 and #38859.

- [ ] closes #38914 #38859
- [x] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry


Labels:
name: Frequency
description: DateOffsets
name: Stale

Comments:
im wary of this.  inevitably someone is going to be confused as to why `Period(foo, freq= BusinessMonthEnd)` isnt different from `Period(foo, freq= BusinessMonthBegin)`

If we were doing this from scratch, I would keep DateOffsets totally unrelated to PeriodDtypes.
> im wary of this. inevitably someone is going to be confused as to why `Period(foo, freq= BusinessMonthEnd)` isnt different from `Period(foo, freq= BusinessMonthBegin)`
> 
> If we were doing this from scratch, I would keep DateOffsets totally unrelated to PeriodDtypes.

I've removed changes related to `BusinessMonthBegin` and `BusinessMonthEnd` (still, it might make sense to create a proper business month period).
@jbrockmendel - A question: would you prefer `Period(foo, freq = "M") != Period(foo, freq = "MS")` 
or `Period(foo, freq = "M") == Period(foo, freq = "MS")`? 
Assuming that in both cases
 `Period(foo, freq = "M").to_timestamp(how="start") == Period(foo, freq = "MS").to_timestamp(how="start")` 
 and  `Period(foo, freq = "M").to_timestamp(how="end") == Period(foo, freq = "MS").to_timestamp(how="end")`.
The former is easy, and that's how it is in the current version of this PR. The latter would require more analysis on my part, as my first approach at it through the `_lite_rule_alias` `dict` clashes with `DatetimeIndex`.
>  A question: would you prefer Period(foo, freq = "M") != Period(foo, freq = "MS")
or Period(foo, freq = "M") == Period(foo, freq = "MS")?

I think I would prefer that `Period(foo, freq="MS")` continue to raise.

The connection between DateOffset subclasses and valid Period freqs is basically a coincidence.  There is not a 1-1 mapping between them, and trying to shoehorn one in is going to make this less clear to people.
> can you add a test for this that fails on current master.
> 
> you also need to adjust tests for this change.

done
I find this really sketchy.  MonthBegin doesn't correspond to a Period.  I just dont understand the motivation here.
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.
@Pawel-Kranzberg can you address https://github.com/pandas-dev/pandas/pull/39887#issuecomment-828108580
> @Pawel-Kranzberg can you address [#39887 (comment)](https://github.com/pandas-dev/pandas/pull/39887#issuecomment-828108580)

I plan to do it next week. In a nutshell, there are existing issues that reference the need for `MonthBegin` as `Offset` and I also faced it during a project at work. Ended up coding a workaround that made code maintenance more challenging.
Thanks for the PR, but it appears that it has gotten stale and there's some uncertainty that around this proposed change.

Closing, but glad to have you help on other open issues.