Skip to content

Commit aa305f3

Browse files
authored
CLN: DatetimeTZBlock don't override values_for_json (#46993)
* CLN: DatetimeTZBlock don't override values_for_json * Update blocks.py
1 parent 3919997 commit aa305f3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/internals/blocks.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1989,11 +1989,9 @@ class DatetimeTZBlock(DatetimeLikeBlock):
19891989
_validate_ndim = True
19901990
_can_consolidate = False
19911991

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

19981996

19991997
class ObjectBlock(NumpyBlock):

0 commit comments

Comments
 (0)