Skip to content

CLN: DatetimeTZBlock don't override values_for_json #46993

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 3 commits into from
Jun 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,11 +1989,9 @@ class DatetimeTZBlock(DatetimeLikeBlock):
_validate_ndim = True
_can_consolidate = False

def values_for_json(self) -> np.ndarray:
# force dt64tz to go through object dtype
# tz info will be lost when converting to
# dt64 which is naive
return self.values.astype(object)
# Don't use values_for_json from DatetimeLikeBlock since it is
# an invalid optimization here(drop the tz)
values_for_json = NDArrayBackedExtensionBlock.values_for_json


class ObjectBlock(NumpyBlock):
Expand Down