-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
WIP warn if parsing with du_parse #47828
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
Conversation
The issue is that in
, resetting the index will try to insert an element into a datetime index. hence, it'll try to parse the new element as a date, and this'll trigger the new warning There's currently no way of catching multiple warnings, so perhaps that should be addressed first EDIt: passing multiple warnings as a tuple works fine |
@@ -238,6 +238,17 @@ cdef inline bint does_string_look_like_time(str parse_string): | |||
|
|||
return 0 <= hour <= 23 and 0 <= minute <= 59 | |||
|
|||
from pandas.util._exceptions import find_stack_level |
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.
is there an option that avoids importing from outside libs here?
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.
yup, could set it explicitly each time - I'll do that once I've sorted out the tests
8eab6e9
to
33fd5b6
Compare
timedelta_index = pd.to_timedelta(np.arange(5), unit="s") | ||
period_index = pd.period_range("2000/1/1", "2010/1/1/", freq="M") | ||
period_index = pd.period_range("1/1/2000", "1/1/2010", freq="M") |
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.
pd.to_datetime(["2000/1/1", "2010/1/1"])
doesn't raise, but pd.period_range("2000/1/1", "2010/1/1/", freq="M")
does
don't know why, need to investigate
6051071
to
ee5c80c
Compare
|
||
def du_parse_with_warning(*args, **kwargs): | ||
parsed = du_parse(*args, **kwargs) | ||
warnings.warn( |
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.
do we take a perf hit here?
759c499
to
a6e801d
Compare
a6e801d
to
b639c09
Compare
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. |
still working on this |
closing, as from #12585 (comment) I don't think this is the right solution |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.