Skip to content

Commit d21c195

Browse files
committed
Frequency: raise warnings when using ‘M’ frequency
1 parent 1f7a7f2 commit d21c195

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/_libs/tslibs/offsets.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ from cpython.datetime cimport (
1212
time as dt_time,
1313
timedelta,
1414
)
15+
import warnings
1516

1617
import_datetime()
1718

@@ -4220,6 +4221,11 @@ cpdef to_offset(freq):
42204221

42214222
tups = zip(split[0::4], split[1::4], split[2::4])
42224223
for n, (sep, stride, name) in enumerate(tups):
4224+
if name == 'M':
4225+
warnings.warn(
4226+
f"'M' will be deprecated, please use 'ME' for 'month end'",
4227+
UserWarning,
4228+
)
42234229
if sep != "" and not sep.isspace():
42244230
raise ValueError("separator must be spaces")
42254231
prefix = _lite_rule_alias.get(name) or name

0 commit comments

Comments
 (0)