Skip to content

ENH: maybe_convert_objects corner cases #41714

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

Merged
merged 5 commits into from
Jun 2, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

@jreback jreback added the Dtype Conversions Unexpected or buggy dtype conversions label May 31, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

does this have any user facing change?

@@ -2550,6 +2576,26 @@ def maybe_convert_objects(ndarray[object] objects,
return objects


cdef _infer_all_nats(dtype, ndarray datetimes, ndarray timedeltas):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

can you type dtype & narrow the types on datetimes/timedeltas if possible.

also a return type ?

Copy link
Member Author

Choose a reason for hiding this comment

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

not really, as there is no good way to declare ndarray[dt64], and both the dtype arg and return type aren't representable here

@jbrockmendel
Copy link
Member Author

does this have any user facing change?

not that im aware of.

motivating goal is to eventually kill off maybe_infer_to_datetimelike (along with the PR deprecating the string inference) and just use lib.maybe_convert_objects(values, convert_datetime=True, convert_timedelta=True)

@jreback
Copy link
Contributor

jreback commented Jun 2, 2021

can you rebase.

maybe_convert_objects is getting pretty long......

@jbrockmendel
Copy link
Member Author

maybe_convert_objects is getting pretty long......

on the plus side its mostly flat (at least the recent additions are). im optimistic we can get rid of some other conversion functions/special-casing and it'll be extremely worth it (xref #40489 could use your input)

@jreback jreback added this to the 1.3 milestone Jun 2, 2021
@jreback jreback merged commit e186e18 into pandas-dev:master Jun 2, 2021
@jbrockmendel jbrockmendel deleted the enh-maybe_convert_objects branch June 2, 2021 17:00
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants