We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 23d5aa6 commit f24f7b9Copy full SHA for f24f7b9
pandas/io/json/_json.py
@@ -300,6 +300,8 @@ def __init__(
300
raise ValueError(msg)
301
302
obj = obj.copy()
303
+
304
+ # Convert DataFrame to handled types before serializing
305
if obj.index.nlevels == 1 and isinstance(obj.index, MultiIndex):
306
obj.index = obj.index.get_level_values(0)
307
@@ -308,7 +310,7 @@ def __init__(
308
310
timedeltas = obj.select_dtypes(include=["timedelta"]).columns
309
311
if len(timedeltas):
312
obj[timedeltas] = obj[timedeltas].applymap(lambda x: x.isoformat())
- # Convert PeriodIndex to datetimes before serializing
313
314
if is_period_dtype(obj.index.dtype):
315
obj.index = obj.index.to_timestamp()
316
0 commit comments