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: move maybe_casted_values from pandas/core/frame.py to pandas/core/dtype/cast.py #36985

Merged
merged 9 commits into from
Oct 10, 2020

Conversation

arw2019
Copy link
Member

@arw2019 arw2019 commented Oct 8, 2020

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

xref #36876, #27370 (stale PR)

@jbrockmendel
Copy link
Member

For something thats only used once, im not sure it is worth moving. Definitely worth seeing if this can be simplified though, per a couple of TODO comments in there

@jreback jreback added Clean Dtype Conversions Unexpected or buggy dtype conversions labels Oct 8, 2020
@arw2019 arw2019 force-pushed the move_maybe_casted_values_to_cast branch 2 times, most recently from ee5e2e0 to b59f39b Compare October 9, 2020 16:39
values_type = type(values)
values_dtype = values.dtype

from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
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 sure this is acceptable - will change if not. The issue is we can't just import at the top of the file because of a circular import

Copy link
Member

Choose a reason for hiding this comment

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

you could do needs_i8_conversion(values.dtype) and isinstance(values, ExtensionArray)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok fine with cleaning this up after, this routine definitely needs it (and also possibly is duplicative of things in this file anyways)

Copy link
Member Author

Choose a reason for hiding this comment

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

you could do needs_i8_conversion(values.dtype) and isinstance(values, ExtensionArray)

tried it and it broke some tests. I'll investigate in the follow-on

@arw2019
Copy link
Member Author

arw2019 commented Oct 9, 2020

Definitely worth seeing if this can be simplified though, per a couple of TODO comments in there

@jbrockmendel Will do! (in a followon)

@arw2019 arw2019 force-pushed the move_maybe_casted_values_to_cast branch 2 times, most recently from 988354d to c349f82 Compare October 10, 2020 05:04
@jreback jreback added this to the 1.2 milestone Oct 10, 2020
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.

can you merge master and ping on green

values_type = type(values)
values_dtype = values.dtype

from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
Copy link
Contributor

Choose a reason for hiding this comment

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

ok fine with cleaning this up after, this routine definitely needs it (and also possibly is duplicative of things in this file anyways)

@arw2019 arw2019 force-pushed the move_maybe_casted_values_to_cast branch from c349f82 to 20c2620 Compare October 10, 2020 16:37
@jreback
Copy link
Contributor

jreback commented Oct 10, 2020

ping on green-ish (meaning either green or a specific buidl is failing on completely unrelated; though I think @jbrockmendel may have fixed this).

@jreback jreback merged commit b88498c into pandas-dev:master Oct 10, 2020
@jreback
Copy link
Contributor

jreback commented Oct 10, 2020

thanks @arw2019

if you can rebase the typing one on master would be great.

@arw2019
Copy link
Member Author

arw2019 commented Oct 11, 2020

thanks @arw2019

Thanks @jreback @jbrockmendel for reviewing!

if you can rebase the typing one on master would be great.

Done

kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants