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

ENH: support datetime64, datetime64tz in nanops.mean, nanops.median #29941

Merged
merged 14 commits into from
Feb 12, 2020

Conversation

jbrockmendel
Copy link
Member

Tracking down relevant issues and figuring out test coverage is the "WIP" part of this.

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Datetime Datetime data dtype labels Dec 1, 2019
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.

looks fine, can you add a deprecation note

pandas/core/frame.py Show resolved Hide resolved
# e.g. in nanops trying to convert strs to float
# TODO: the ValueError is raised in trying to convert str
Copy link
Contributor

Choose a reason for hiding this comment

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

yes this should be a TypeError, where is the ValueError coming from?

Copy link
Contributor

Choose a reason for hiding this comment

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

what is trying to convert to str?

Copy link
Contributor

Choose a reason for hiding this comment

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

do you still need this ValueError? (as i think you changed below)

Copy link
Member Author

Choose a reason for hiding this comment

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

i'll re-run without catching ValueError. IIRC it was in nanops._ensure_numeric

Copy link
Member Author

Choose a reason for hiding this comment

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

yah, there are 3 tests where x.astype(np.float64) raises a ValueError in _ensure_numeric with a object-dtype x that contains a string.

Copy link
Member Author

Choose a reason for hiding this comment

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

just removed this and re-raised as TypeError on nanops 1292-1296

@jreback jreback added the Timezones Timezone data dtype label Dec 1, 2019
@jbrockmendel jbrockmendel changed the title WIP/ENH: support datetime64, datetime64tz in nanops.mean, nanops.median ENH: support datetime64, datetime64tz in nanops.mean, nanops.median Dec 25, 2019
pandas/core/frame.py Show resolved Hide resolved
# e.g. in nanops trying to convert strs to float
# TODO: the ValueError is raised in trying to convert str
Copy link
Contributor

Choose a reason for hiding this comment

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

what is trying to convert to str?

# e.g. in nanops trying to convert strs to float
# TODO: the ValueError is raised in trying to convert str
Copy link
Contributor

Choose a reason for hiding this comment

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

do you still need this ValueError? (as i think you changed below)

pandas/tests/frame/test_analytics.py Show resolved Hide resolved
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.

small comments, but can merge if blocking

pandas/core/nanops.py Show resolved Hide resolved
pandas/core/nanops.py Show resolved Hide resolved
pandas/core/frame.py Show resolved Hide resolved
@jreback jreback added this to the 1.1 milestone Dec 27, 2019
pandas/core/frame.py Show resolved Hide resolved
@jreback
Copy link
Contributor

jreback commented Jan 26, 2020

this looks good. can you add a deprecation note in whatsnew and rebase.

@jbrockmendel
Copy link
Member Author

whatsnew added, rebased+green

@jreback
Copy link
Contributor

jreback commented Feb 9, 2020

lgtm. once more rebase and merge on green. (also add to the deprecated issue tracker as well).

@WillAyd WillAyd merged commit a4d743e into pandas-dev:master Feb 12, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 12, 2020

Thanks @jbrockmendel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants