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

BUG: inconsistency between frame.any/all with dt64 vs dt64tz #38723

Merged
merged 13 commits into from
Dec 30, 2020

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Dec 27, 2020

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

# Reductions

def any(self, *, axis: Optional[int] = None, skipna: bool = True):
# GH#33478
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why this isn't GH 38723?

Copy link
Member Author

@jbrockmendel jbrockmendel Dec 27, 2020

Choose a reason for hiding this comment

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

typo, should be #34479, which is about the long-term behavior we want, #38723 is about ensuring that the interim behavior is internally-consistent. just updated

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM just one question

@mroeschke mroeschke added this to the 1.3 milestone Dec 27, 2020
@mroeschke mroeschke added Bug Reduction Operations sum, mean, min, max, etc. Datetime Datetime data dtype labels Dec 27, 2020
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

What is the inconsistency this is fixing? (how is it behaving differently?)

@jbrockmendel
Copy link
Member Author

What is the inconsistency this is fixing? (how is it behaving differently?)

dti = pd.date_range("2016-01-01", periods=3)
dti2 = dti.tz_localize("UTC")

df = pd.DataFrame(dti)
df2 = pd.DataFrame(dti2)

>>> df.all()
0    True
dtype: bool

>>> df2.all()
Series([], dtype: bool)

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Dec 29, 2020

Thanks for that example, that helps ;)
(in general, it would help if you try give a bit more context when opening PRs)

That's indeed certainly an inconsistency to fix. But quickly checking, this actually seems to have worked fine before, so might be a regression? (and thus should potentially target this for 1.2.1)

@jorisvandenbossche jorisvandenbossche modified the milestones: 1.3, 1.2.1 Dec 29, 2020
simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this pull request Dec 29, 2020
@@ -190,6 +190,7 @@ Datetimelike
- Bug in :class:`DataFrame` and :class:`Series` constructors sometimes dropping nanoseconds from :class:`Timestamp` (resp. :class:`Timedelta`) ``data``, with ``dtype=datetime64[ns]`` (resp. ``timedelta64[ns]``) (:issue:`38032`)
- Bug in :meth:`DataFrame.first` and :meth:`Series.first` returning two months for offset one month when first day is last calendar day (:issue:`29623`)
- Bug in constructing a :class:`DataFrame` or :class:`Series` with mismatched ``datetime64`` data and ``timedelta64`` dtype, or vice-versa, failing to raise ``TypeError`` (:issue:`38575`)
- Bug in :meth:`DataFrame.any` and :meth:`DataFrame.all` behaving differently for tznaive vs tzaware ``datetime64`` dtypes (:issue:`38723`)
Copy link
Contributor

Choose a reason for hiding this comment

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

move to 1.2.1

Copy link
Member Author

Choose a reason for hiding this comment

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

updated+green

@simonjayhawkins
Copy link
Member

this actually seems to have worked fine before, so might be a regression?

first bad commit: [50ae0bf] BUG: DataFrame reductions inconsistent with Series counterparts (#37827)

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

I suppose this will also enable the any/all methods on Series?
(in which case we should add tests for that)

@jreback jreback merged commit fdc2585 into pandas-dev:master Dec 30, 2020
@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

@meeseeksdev backport 1.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Dec 30, 2020

Something went wrong ... Please have a look at my logs.

jreback pushed a commit that referenced this pull request Dec 30, 2020
…4 vs dt64tz (#38807)

Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
@jbrockmendel jbrockmendel deleted the compat-dtlike-reductions branch December 30, 2020 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants