-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPR offsets: rename 'M' to 'ME' #52064
Merged
mroeschke
merged 130 commits into
pandas-dev:main
from
natmokval:9586-inconsistent-labeling-sub-daily-super-daily-frequencies
Sep 20, 2023
Merged
Changes from all commits
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
d21c195
Frequency: raise warnings when using ‘M’ frequency
natmokval 6522436
Frequency: raise warnings when using ‘M’ frequency II
natmokval 8e2b974
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 184debf
remove is_period and change str representation for freq in Period [sk…
natmokval e1d82cb
remove is_period and fix some tests [skip ci]
natmokval 55c4d76
fix some tests
natmokval 24756bc
fix some tests II
natmokval 989db20
fix tests in pandas/tests/indexes/period/ [skip ci]
natmokval 253b823
fix tests in pandas/tests/indexes/period/ and correct timedeltas.pyx
natmokval bfb59ae
fix tests in pandas/tests/indexes/period/ and correct timedeltas.pyx
natmokval 266c480
update frequencies.py, resample.py, and fix some tests
natmokval c204645
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval dfbc1ed
modify pandas/tseries/frequencies.py
natmokval 06c1473
fix tests
natmokval 4c9b621
fix tests II
natmokval a9bd9db
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval b64e15d
fix tests III
natmokval 0744e9a
rename 'M' to 'ME' in docs
natmokval c640779
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 305d035
rename 'M' to 'ME' in docs II
natmokval 31f4cef
rename 'M' to 'ME' in docs III
natmokval 70cd19d
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 5d9cad5
rename 'M' to 'ME' in docs IV
natmokval f695a80
rename 'M' to 'ME' in docs V
natmokval 0dfeece
rename 'M' to 'ME' in docs VI
natmokval 87b36ab
add is_period to to_offset I
natmokval 5c68420
add is_period to to_offset and merge main
natmokval 69e8ade
add is_period to to_offset II
natmokval 18be333
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval fe8a199
correct the definition of period_array(…) and fix 19 tests
natmokval c763b5e
add is_period to _parse_dtype_strict() and fix tests
natmokval a0cdb11
add constant OFFSET_TO_PERIOD_FREQSTR to period.pyx and fix tests
natmokval 92792ec
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval ba1220e
correct definitions of extract_ordinals() and _round(), fix tests
natmokval dcea43b
add replacement ME to M in _require_matching_freq, _parsed_string_to_…
natmokval 7ad194a
resolve conflict in test_replace.py
natmokval baceaf2
add the constant PERIOD_TO_OFFSET_FREQSTR to period.pyx, correct defi…
natmokval d589c68
fix tests
natmokval 16db0b7
add the conversion ME to M to _from_datetime64, period_index, raise_o…
natmokval 4defaf9
fix some tests with resample
natmokval cc7b069
correct definitions of to_period, freqstr and get_period_alias, fix t…
natmokval 33e0ac1
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval a1701e4
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval e6b62d9
correct pre-commit failures
natmokval e1f0d65
add key from Grouper to the constructor of TimeGrouper and fix tests
natmokval db3124e
add to asfreq() from resampler the conversion ME to M, fix tests
natmokval 37e4baa
fix tests for for PeriodIndex and base tests for resample
natmokval a101781
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 6c195e9
correct the constructor of TimeGrouper and fix tests for resample and…
natmokval 5a5916d
correct the definition of use_dynamic_x() and fix tests for plotting
natmokval adff5ae
correct the definition of the method use_dynamic_x, fix tests
natmokval 8af8a36
correct the definition of the asfreq for PeriodArray, _get_period_ali…
natmokval 0ab5c1e
resolve conflicts
natmokval 9bbb970
correct documentation, fix tests
natmokval 6544053
correct docs: rename ME to M for periods
natmokval b032018
resolve conflicts
natmokval 7233fab
add pytest.mark.xfail to test_to_timestamp_quarterly_bug
natmokval 055a14f
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval b8a6827
correct mypy error attr-defined
natmokval 4023a54
correct the definition of variables which convert M/ME to ME/M in dty…
natmokval 562d92a
created the c version for dicts which convert M/ME to ME/M and fix my…
natmokval 9106ee9
fix doc build error in 09_timeseries.rst and mypy error
natmokval da2a32f
correct the constructor of Period, fix mypy errors
natmokval 9e7374c
replace in _attrname_to_abbrevs ME with M and correct the constructor…
natmokval e352f82
add conversion ME/M to Period constructor, add conversion M/ME to may…
natmokval fd3174a
correct dict “time rules”, correct the definition of _parsed_string_t…
natmokval 524621a
remove the argument is_period from _parse_dtype_strict
natmokval 021d980
add to is_subperiod, is_superperiod and _is_monthly both M and ME, co…
natmokval 35e0146
add dict ME to M to the definition of freqstr, constructor of Period …
natmokval db84369
refactor freqstr, extract_ordinals, and _require_matching_freq for P…
natmokval 563c775
refactor _resolution_obj in dtypes.pyx and freqstr in /indexes/dateti…
natmokval c870d1b
define a new function freq_to_period_freqstr in dtypes to convert ME …
natmokval 4c299cf
refactor use_dynamic_x for plotting and to_period in arrays/datetimes.py
natmokval 55865c9
refactor def _check_plot_works in plotting and test_to_period in clas…
natmokval a404fa2
resolve conflict
natmokval b0bd2d8
refactor name method of PeriodDtype, refactor __arrow_array__ and a…
natmokval b947e6a
resolve conflict in pandas/tests/resample/test_base.py
natmokval 3ab6833
in PeriodArray refactor _from_datetime64 and remove redundant if in …
natmokval cfb60a3
correct def _resolution_obj in DatetimeLikeArrayMixin, refactor def f…
natmokval 223540c
correct def _resolution_obj in DatetimeLikeArrayMixin and def to_offs…
natmokval 0060761
add tests for 'UserWarning'
natmokval 239090b
refactor methods to_period in DatetimeArray, _from_datetime64 in Peri…
natmokval 6a816ef
add freq_to_offset_freqstr to convert M to ME, refactor _resolution_o…
natmokval 8cbe679
resolve conflict
natmokval b1e0ad7
fix pre-commit failures
natmokval 454b685
correct the definition of to_period in DatetimeArray, refactor _chec…
natmokval fa8e15d
correct definitions of _resolution_obj in dtypes.pyx and in DatetimeL…
natmokval 34b5957
correct def asfreq in PeriodArray, remove unused function freq_to_off…
natmokval 3a8dcc1
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 02c83f3
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 120355d
roll back in test_fillna_period dtype Period[M] with capital P
natmokval 16e9376
refactor the function raise_on_incompatible
natmokval a1fd73c
fix mypy error in pandas/core/arrays/period.py
natmokval c1beb9f
resolve conflicts and fix tests in plotting
natmokval 5052630
fix ruff error in pandas/tests/arrays/period/test_constructors.py
natmokval ccfc4bd
remove ME from definitions of is_monthly, is_subperiod, correct _mayb…
natmokval cff4eeb
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 8c3fc98
fix test_dti_to_period_2monthish
natmokval b89980e
update whatsnew/v2.1.0.rst
natmokval c1d9c79
resolve conflicts
natmokval 6ed4730
add an example for old/new behavior in whatsnew/v2.1.0.rst
natmokval 22fe7e3
corrected typo
natmokval 29c4b72
replace name of section Deprecations with Other Deprecations
natmokval 4d4342b
remove ME form is_superperiod, refactored tests
natmokval e3dcaf6
correct a test
natmokval 616f681
move some tests to a new place
natmokval b6a9a8e
correct def asfreq for resampling, refactor asfreq for Period, fix tests
natmokval 856f09b
correct tests
natmokval cbac3be
correct def _shift_with_freq and fix test for shift
natmokval 383799d
correct docs for asfreq in PeriodArray
natmokval 6432301
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 9d3f15c
correct def _shift_with_freq
natmokval 4f8c861
add ‘me’ to _dont_uppercase, correct _require_matching_freq, fix tests
natmokval 4fade37
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 0286cf6
minor corrections
natmokval e32e8cb
resolve conflicts
natmokval 6ee4554
resolve conflict in whatsnew/v2.1.0.rst
natmokval 549d95b
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 01abf51
resolve conflicts
natmokval 8fb1a4c
resolve conflicts
natmokval 23b567a
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval 3a91cba
correct whatsnew
natmokval ebbcbf5
resolve conflict in v2.2.0.rst
natmokval 882fefa
correct an example in user_guide/reshaping.rst
natmokval 0bd8b1a
resolve conflicts'
natmokval 05d68c8
Merge branch 'main' into 9586-inconsistent-labeling-sub-daily-super-d…
natmokval d4e15e1
fix tests for plotting
natmokval ecee6de
correct tests for plotting
natmokval 141fbdc
resolve conflicts
natmokval 8979eb5
remove from OFFSET_TO_PERIOD_FREQSTR deprecated freqstr, fix tests
natmokval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ from pandas._libs.tslibs.np_datetime cimport ( | |
|
||
import_pandas_datetime() | ||
|
||
|
||
cdef class PeriodDtypeBase: | ||
""" | ||
Similar to an actual dtype, this contains all of the information | ||
|
@@ -186,6 +185,45 @@ _attrname_to_abbrevs = { | |
cdef dict attrname_to_abbrevs = _attrname_to_abbrevs | ||
cdef dict _abbrev_to_attrnames = {v: k for k, v in attrname_to_abbrevs.items()} | ||
|
||
OFFSET_TO_PERIOD_FREQSTR: dict = { | ||
"WEEKDAY": "D", | ||
"EOM": "M", | ||
"BM": "M", | ||
"BQS": "Q", | ||
"QS": "Q", | ||
"BQ": "Q", | ||
"BA": "A", | ||
"AS": "A", | ||
"BAS": "A", | ||
"MS": "M", | ||
"D": "D", | ||
"B": "B", | ||
"min": "min", | ||
"s": "s", | ||
"ms": "ms", | ||
"us": "us", | ||
"ns": "ns", | ||
"H": "H", | ||
"Q": "Q", | ||
"A": "A", | ||
"W": "W", | ||
"ME": "M", | ||
"Y": "A", | ||
"BY": "A", | ||
"YS": "A", | ||
"BYS": "A", | ||
} | ||
cdef dict c_OFFSET_TO_PERIOD_FREQSTR = OFFSET_TO_PERIOD_FREQSTR | ||
|
||
cpdef freq_to_period_freqstr(freq_n, freq_name): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be viable to get away from this entirely and use PeriodDtype(Base)._freqstr? |
||
if freq_n == 1: | ||
freqstr = f"""{c_OFFSET_TO_PERIOD_FREQSTR.get( | ||
freq_name, freq_name)}""" | ||
else: | ||
freqstr = f"""{freq_n}{c_OFFSET_TO_PERIOD_FREQSTR.get( | ||
freq_name, freq_name)}""" | ||
return freqstr | ||
|
||
# Map deprecated resolution abbreviations to correct resolution abbreviations | ||
DEPR_ABBREVS: dict[str, str]= { | ||
"T": "min", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll probably reword this again before the final release when other offsets are included, so I think this is ok for now