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
Copy file name to clipboardExpand all lines: doc/source/io.rst
+26-8Lines changed: 26 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1034,11 +1034,12 @@ with optional parameters:
1034
1034
``columns``; dict like {column -> {index -> value}}
1035
1035
``values``; just the values array
1036
1036
1037
-
- ``date_format`` : type of date conversion (epoch = epoch milliseconds, iso = ISO8601), default is epoch
1037
+
- ``date_format`` : string, type of date conversion, 'epoch' for timestamp, 'iso' for ISO8601.
1038
1038
- ``double_precision`` : The number of decimal places to use when encoding floating point values, default 10.
1039
1039
- ``force_ascii`` : force encoded string to be ASCII, default True.
1040
+
- ``date_unit`` : The time unit to encode to, governs timestamp and ISO8601 precision. One of 's', 'ms', 'us' or 'ns' for seconds, milliseconds, microseconds and nanoseconds respectively. Default 'ms'.
1040
1041
1041
-
Note NaN'sand None will be converted to null and datetime objects will be converted based on the date_format parameter
1042
+
Note NaN's, NaT's and None will be converted to null and datetime objects will be converted based on the date_format and date_unit parameters.
Writing to a file, with a date index and a date column
1059
1074
1060
1075
.. ipython:: python
@@ -1063,7 +1078,7 @@ Writing to a file, with a date index and a date column
1063
1078
dfj2['date'] = Timestamp('20130101')
1064
1079
dfj2['ints'] =list(range(5))
1065
1080
dfj2['bools'] =True
1066
-
dfj2.index = date_range('20130101',periods=5)
1081
+
dfj2.index = date_range('20130101',periods=5)
1067
1082
dfj2.to_json('test.json')
1068
1083
open('test.json').read()
1069
1084
@@ -1113,13 +1128,16 @@ is ``None``. To explicity force ``Series`` parsing, pass ``typ=series``
1113
1128
then pass one of 's', 'ms', 'us' or 'ns' to force timestamp precision to
1114
1129
seconds, milliseconds, microseconds or nanoseconds respectively.
1115
1130
1116
-
The parser will raise one of ``ValueError/TypeError/AssertionError`` if the JSON is
1117
-
not parsable.
1131
+
The parser will raise one of ``ValueError/TypeError/AssertionError`` if the JSON is not parsable.
1118
1132
1119
1133
The default of ``convert_axes=True``, ``dtype=True``, and ``convert_dates=True`` will try to parse the axes, and all of the data
1120
1134
into appropriate types, including dates. If you need to override specific dtypes, pass a dict to ``dtype``. ``convert_axes`` should only
1121
1135
be set to ``False`` if you need to preserve string-like numbers (e.g. '1', '2') in an axes.
1122
1136
1137
+
.. note::
1138
+
1139
+
Large integer values may be converted to dates if ``convert_dates=True`` and the data and / or column labels appear 'date-like'. The exact threshold depends on the ``date_unit`` specified.
1140
+
1123
1141
.. warning::
1124
1142
1125
1143
When reading JSON data, automatic coercing into dtypes has some quirks:
@@ -1146,13 +1164,13 @@ Don't convert any data (but still convert axes and dates)
0 commit comments