-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: to_period() freq was not infered #33406
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
BUG: to_period() freq was not infered #33406
Conversation
we cant rely on grepping to get all the relevant tests. i recommend Look at the failing tests, choose one and start executing it step-by-step in the REPL
|
) | ||
|
||
# Using simple filter because we are not checking for the warning here | ||
warnings.simplefilter("ignore", UserWarning) |
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.
what is the warning from? this would not be set like this
use assert_produces_warning(None):
warnings.simplefiler....
if you really need to
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.
what is the warning from? this would not be set like this
The warning raises when a user is attempting to convert a date_range to period, if the date_range have a timezone it will drop it in the conversion, the warning let the user know about that:
pandas/pandas/core/arrays/datetimes.py
Lines 1085 to 1090 in 3cca07c
if self.tz is not None: | |
warnings.warn( | |
"Converting to PeriodArray/Index representation " | |
"will drop timezone information.", | |
UserWarning, | |
) |
use assert_produces_warning(None):
warnings.simplefiler....if you really need to
Sure! will fix.
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.
i c, ok then
looks good, can you add a whatsnew note in 1.1 in the datetime section for bug fixes. ping on green. |
ping @jreback |
thanks @MomIsBestFriend |
# https://github.com/pandas-dev/pandas/issues/33358 | ||
if res is None: | ||
base, stride = libfrequencies._base_and_stride(freq) | ||
res = f"{stride}{base}" |
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.
@MomIsBestFriend why cant we just do res = freq
here? (im trying to clean up usages of base_and_stride
)
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
When running
pytest -q --cache-clear pandas/tests/ -k "period"
some tests inpandas/tests/indexing/
are failing, but when runningpytest -q --cache-clear pandas/tests/indexing/
all the tests are passing (on my local machine), so I figured and debug from here, thoughts?