Get_period_alias(offset_str) function behaves inconsistent


import pandas as pd

print(pd.tseries.frequencies.get_period_alias('AS-JAN')) # works fine
print(pd.tseries.frequencies.get_period_alias('AS-FEB')) # works fine
# ...
print(pd.tseries.frequencies.get_period_alias('W-MON')) # offset not removed
print(pd.tseries.frequencies.get_period_alias('W-TUE')) # offset not removed
# ...
print(pd.tseries.frequencies.get_period_alias('A-JAN')) # offset not removed
print(pd.tseries.frequencies.get_period_alias('A-FEB')) # offset not removed
# ...

Problem description

The Get_period_alias(offset_str) behaves inconsistent for different frequencies. See code sample for examples. The offset information (JAN, FEB, MON, TUE, ... ) should be removed. The issue should be easy to resolve by modifying the following lines:

https://github.com/pandas-dev/pandas/blob/1f6710035a5295b2d3171ab811ae7ffca2344389/pandas/tseries/frequencies.py#L81-L87

Output:

A
A
W-MON
W-TUE
A-JAN
A-FEB

Expected Output

A
A
W
W
A
A

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : db08276bc116c438d3fdee492026f8223584c477 python : 3.7.0.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.17763 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : None.None pandas : 1.1.3 numpy : 1.16.3 pytz : 2018.5 dateutil : 2.7.3 pip : 19.1.1 setuptools : 50.3.0 Cython : 0.28.5 pytest : 4.0.1 hypothesis : None sphinx : 2.2.1 blosc : None feather : None xlsxwriter : 1.1.0 lxml.etree : 4.2.5 html5lib : 1.0.1 pymysql : None psycopg2 : None jinja2 : 2.11.1 IPython : 6.5.0 pandas_datareader: None bs4 : 4.6.3 bottleneck : 1.2.1 fsspec : None fastparquet : None gcsfs : None matplotlib : 2.2.3 numexpr : 2.6.8 odfpy : None openpyxl : 3.0.3 pandas_gbq : None pyarrow : None pytables : None pyxlsb : None s3fs : None scipy : 1.1.0 sqlalchemy : 1.3.13 tables : 3.4.4 tabulate : None xarray : None xlrd : 1.2.0 xlwt : 1.3.0 numba : 0.39.0

Comment From: jbrockmendel

Why? What user-facing behavior would this change/fix?

Comment From: stephprobst

Isn't pd.tseries.frequencies.get_period_alias itself user-facing? If not, shouldn't it be prefixed with an underscore?

I'm personally using the function to extract the period information after using pd.infer_freq.

Comment From: jbrockmendel

Good question. I don't usually think of things buried this deep as being public, but to_offset is in that file and is pretty public.