Skip to content
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

CLN: remove unused entries from _lite_rule_alias #56516

Closed

Conversation

natmokval
Copy link
Contributor

xref #56346

remove unused entries "min", "ms", "us", "ns" from _lite_rule_alias

@natmokval natmokval added the Frequency DateOffsets label Dec 15, 2023
@natmokval natmokval changed the title ENC: remove unused entries from _lite_rule_alias ENH: remove unused entries from _lite_rule_alias Dec 15, 2023
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, should be good, just a comment

Comment on lines 4671 to 4673
"min",
"ns",
"us",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove unrelated changes please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove these from _dont_uppercase the tests test_offset_freqstr() and test_rule_code() in pandas/tests/tseries/offsets/test_offsets.py will fail. The reason: we uppercase names of offsets class in _get_offset(). In PR #56346 where we deprecate uppercasing/lowercasing we will remove them from _dont_uppercase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks - so, they're not currently unused then? but will become unused once #56346 is enforced? should this PR wait until after that one then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked in PR #56346, we should keep "min", "us", "ns" in the list _dont_uppercase to pass these tests.
On the other hand, we have all lowercase offsets frequencies in this list ('h', 's', etc.), and it looks more clear then have these entries ("min": "min", "us": "us", etc.) in dict _lite_rule_alias.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for explaining

sorry for not having got round to this yet, was quite this week with a client project - but I'll get to it, thanks for looking at it all so carefully!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for helping me with my PRs!

@MarcoGorelli MarcoGorelli changed the title ENH: remove unused entries from _lite_rule_alias CLN: remove unused entries from _lite_rule_alias Dec 19, 2023
freq="US",
freq="us",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this PR make to_offset('US') suddently start failing? if so, I don't think we can do this yet (at least, not before https://github.com/pandas-dev/pandas/pull/56346/files ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this PR make to_offset('US') suddently start failing? if so, I don't think we can do this yet (at least, not before https://github.com/pandas-dev/pandas/pull/56346/files ?)

yes, this test didn't fail for uppercase frequency "US" before this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small correction to the comment above:
we fixed the test_partial_slice_second_precision in PR DEPR: lowercase strings denoting freq for Week, MonthBegin, MonthEnd, etc. #56346
but so far on main we have to_offset('US') in this test and it pass.

Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jan 20, 2024
@MarcoGorelli
Copy link
Member

I tried to do something similar in #59240 - fancy taking a look please?

@natmokval
Copy link
Contributor Author

natmokval commented Jul 18, 2024

I tried to do something similar in #59240 - fancy taking a look please?

yeah, sure, I'll take a look.

@natmokval
Copy link
Contributor Author

I got the same idea, to move aliases "us", and"ns" from _lite_rule_alias to c_PERIOD_AND_OFFSET_DEPR_FREQSTR.

seems like all tests passes except some tests in pandas/tests/tseries/offsets/test_offsets.py.

@natmokval
Copy link
Contributor Author

closed as completed via #59240

@natmokval natmokval closed this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants