Skip to content

Commit cf34164

Browse files
authored
Update json.py
BUG : read_json with table='orient' causes unexpected type coercion pandas-dev#21345
1 parent 415012f commit cf34164

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/io/json/json.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,12 @@ def _try_convert_data(self, name, data, use_dtypes=True,
706706
except (TypeError, ValueError):
707707
pass
708708

709-
# do't coerce 0-len data
709+
# don't coerce 0-len data
710710
if len(data) and (data.dtype == 'float' or data.dtype == 'object'):
711711

712-
# coerce ints if we can
712+
# coerce float if we can
713713
try:
714-
new_data = data.astype('int64')
714+
new_data = data.astype('float64')
715715
if (new_data == data).all():
716716
data = new_data
717717
result = True
@@ -721,7 +721,7 @@ def _try_convert_data(self, name, data, use_dtypes=True,
721721
# coerce ints to 64
722722
if data.dtype == 'int':
723723

724-
# coerce floats to 64
724+
# coerce ints to 64
725725
try:
726726
data = data.astype('int64')
727727
result = True

0 commit comments

Comments
 (0)