Skip to content

BUG: Series.mode with dt64tz or PeriodDtype #44582

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 9 commits into from
Nov 26, 2021

Conversation

jbrockmendel
Copy link
Member

Sits on top of #44581

@jbrockmendel jbrockmendel changed the title Bug mode BUG: Series.mode with dt64tz or PeriodDtype Nov 22, 2021
@jreback jreback added this to the 1.4 milestone Nov 25, 2021
@jreback jreback added Bug Timezones Timezone data dtype labels Nov 25, 2021
# type, _SupportsDType, str, Union[Tuple[Any, int], Tuple[Any, Union[int,
# Sequence[int]]], List[Any], _DTypeDict, Tuple[Any, Any]]]"
return self._ndarray.view(dtype=dtype) # type: ignore[return-value,arg-type]
return super().view(dtype)
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 remove this entirely (since it will just user the super view anyhow)?

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 with the @overloads just above this

assert res.dtype == ser.dtype
tm.assert_series_equal(res, ser)

res = pd.core.algorithms.mode(ser._values)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we have a rule which prevents this? e.g. can you import at the top instead

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 about the rule. will move the import

@jreback
Copy link
Contributor

jreback commented Nov 26, 2021

i ithink this needs a rebase as merged the underlying PR

@jbrockmendel
Copy link
Member Author

Rebased +greenish

@jreback jreback merged commit 014ea2e into pandas-dev:master Nov 26, 2021
@jbrockmendel jbrockmendel deleted the bug-mode branch November 26, 2021 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Timezones are not preserved in Series.mode() output
2 participants