You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1101,6 +1166,9 @@ Writing to a file, with a date index and a date column
1101
1166
dfj2.to_json('test.json')
1102
1167
open('test.json').read()
1103
1168
1169
+
Fallback Behavior
1170
+
+++++++++++++++++
1171
+
1104
1172
If the JSON serialiser cannot handle the container contents directly it will fallback in the following manner:
1105
1173
1106
1174
- if a ``toDict`` method is defined by the unrecognised object then that
@@ -1182,7 +1250,7 @@ is ``None``. To explicity force ``Series`` parsing, pass ``typ=series``
1182
1250
- ``convert_dates`` : a list of columns to parse for dates; If True, then try to parse datelike columns, default is True
1183
1251
- ``keep_default_dates`` : boolean, default True. If parsing dates, then parse the default datelike columns
1184
1252
- ``numpy`` : direct decoding to numpy arrays. default is False;
1185
-
Note that the JSON ordering **MUST** be the same for each term if ``numpy=True``
1253
+
Supports numeric data only, although labels may be non-numeric. Also note that the JSON ordering **MUST** be the same for each term if ``numpy=True``
1186
1254
- ``precise_float`` : boolean, default ``False``. Set to enable usage of higher precision (strtod) function when decoding string to double values. Default (``False``) is to use fast but less precise builtin functionality
1187
1255
- ``date_unit`` : string, the timestamp unit to detect if converting dates. Default
1188
1256
None. By default the timestamp precision will be detected, if this is not desired
@@ -1191,6 +1259,13 @@ is ``None``. To explicity force ``Series`` parsing, pass ``typ=series``
1191
1259
1192
1260
The parser will raise one of ``ValueError/TypeError/AssertionError`` if the JSON is not parsable.
1193
1261
1262
+
If a non-default ``orient`` was used when encoding to JSON be sure to pass the same
1263
+
option here so that decoding produces sensible results, see `Orient Options`_ for an
1264
+
overview.
1265
+
1266
+
Data Conversion
1267
+
+++++++++++++++
1268
+
1194
1269
The default of ``convert_axes=True``, ``dtype=True``, and ``convert_dates=True`` will try to parse the axes, and all of the data
1195
1270
into appropriate types, including dates. If you need to override specific dtypes, pass a dict to ``dtype``. ``convert_axes`` should only
1196
1271
be set to ``False`` if you need to preserve string-like numbers (e.g. '1', '2') in an axes.
@@ -1209,31 +1284,31 @@ be set to ``False`` if you need to preserve string-like numbers (e.g. '1', '2')
1209
1284
1210
1285
Thus there are times where you may want to specify specific dtypes via the ``dtype`` keyword argument.
1211
1286
1212
-
Reading from a JSON string
1287
+
Reading from a JSON string:
1213
1288
1214
1289
.. ipython:: python
1215
1290
1216
1291
pd.read_json(json)
1217
1292
1218
-
Reading from a file
1293
+
Reading from a file:
1219
1294
1220
1295
.. ipython:: python
1221
1296
1222
1297
pd.read_json('test.json')
1223
1298
1224
-
Don't convert any data (but still convert axes and dates)
1299
+
Don't convert any data (but still convert axes and dates):
0 commit comments