-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/API: Disallow unit if input to Timedelta and to_timedelta is/contains str #34634
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
Can you add a test for the behavior? This is typically the first thing we look for in any PR |
this is a replacement for #34379? |
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.
@pdnm like this PR a lot better; just some small comments, ping on green.
@jreback Fixed. Thanks! |
pandas/_libs/tslibs/timedeltas.pyx
Outdated
|
||
# Usually, we have all strings. If so, we hit the fast path. | ||
# If this path fails, we try conversion a different way, and | ||
# this is where all of the error handling will take place. | ||
try: | ||
for i in range(n): | ||
if isinstance(values[i], str): |
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.
this should be in the clause on L251
thanks @pdnm very nice patch! keep em coming! |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff