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
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@
29
29
IO Tools (Text, CSV, HDF5, ...)
30
30
*******************************
31
31
32
-
The pandas I/O api is a set of top level ``reader`` functions accessed like ``pd.read_csv()`` that generally return a ``pandas``
32
+
The pandas I/O API is a set of top level ``reader`` functions accessed like ``pd.read_csv()`` that generally return a ``pandas``
33
33
object.
34
34
35
35
* :ref:`read_csv<io.read_csv_table>`
@@ -78,8 +78,8 @@ for some advanced strategies
78
78
79
79
They can take a number of arguments:
80
80
81
-
- ``filepath_or_buffer``: Either a string path to a file, url
82
-
(including http, ftp, and s3 locations), or any object with a ``read``
81
+
- ``filepath_or_buffer``: Either a string path to a file, URL
82
+
(including http, ftp, and S3 locations), or any object with a ``read``
83
83
method (such as an open file or ``StringIO``).
84
84
- ``sep`` or ``delimiter``: A delimiter / separator to split fields
85
85
on. `read_csv` is capable of inferring the delimiter automatically in some
@@ -1100,7 +1100,7 @@ function takes a number of arguments. Only the first is required.
1100
1100
used. (A sequence should be given if the DataFrame uses MultiIndex).
1101
1101
- ``mode`` : Python write mode, default 'w'
1102
1102
- ``encoding``: a string representing the encoding to use if the contents are
1103
-
non-ascii, for python versions prior to 3
1103
+
non-ASCII, for python versions prior to 3
1104
1104
- ``line_terminator``: Character sequence denoting line end (default '\\n')
1105
1105
- ``quoting``: Set quoting rules as in csv module (default csv.QUOTE_MINIMAL)
1106
1106
- ``quotechar``: Character used to quote fields (default '"')
@@ -1184,7 +1184,7 @@ with optional parameters:
1184
1184
- ``double_precision`` : The number of decimal places to use when encoding floating point values, default 10.
1185
1185
- ``force_ascii`` : force encoded string to be ASCII, default True.
1186
1186
- ``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'.
1187
-
- ``default_handler`` : The handler to call if an object cannot otherwise be converted to a suitable format for JSON. Takes a single argument, which is the object to convert, and returns a serialisable object.
1187
+
- ``default_handler`` : The handler to call if an object cannot otherwise be converted to a suitable format for JSON. Takes a single argument, which is the object to convert, and returns a serializable object.
1188
1188
1189
1189
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.
1190
1190
@@ -1208,7 +1208,7 @@ file / string. Consider the following DataFrame and Series:
1208
1208
sjo = Series(dict(x=15, y=16, z=17), name='D')
1209
1209
sjo
1210
1210
1211
-
**Column oriented** (the default for ``DataFrame``) serialises the data as
1211
+
**Column oriented** (the default for ``DataFrame``) serializes the data as
1212
1212
nested JSON objects with column labels acting as the primary index:
1213
1213
1214
1214
.. ipython:: python
@@ -1224,7 +1224,7 @@ but the index labels are now primary:
1224
1224
dfjo.to_json(orient="index")
1225
1225
sjo.to_json(orient="index")
1226
1226
1227
-
**Record oriented** serialises the data to a JSON array of column -> value records,
1227
+
**Record oriented** serializes the data to a JSON array of column -> value records,
1228
1228
index labels are not included. This is useful for passing DataFrame data to plotting
1229
1229
libraries, for example the JavaScript library d3.js:
1230
1230
@@ -1233,15 +1233,15 @@ libraries, for example the JavaScript library d3.js:
1233
1233
dfjo.to_json(orient="records")
1234
1234
sjo.to_json(orient="records")
1235
1235
1236
-
**Value oriented** is a bare-bones option which serialises to nested JSON arrays of
1236
+
**Value oriented** is a bare-bones option which serializes to nested JSON arrays of
1237
1237
values only, column and index labels are not included:
1238
1238
1239
1239
.. ipython:: python
1240
1240
1241
1241
dfjo.to_json(orient="values")
1242
1242
# Not available for Series
1243
1243
1244
-
**Split oriented** serialises to a JSON object containing separate entries for
1244
+
**Split oriented** serializes to a JSON object containing separate entries for
1245
1245
values, index and columns. Name is also included for ``Series``:
1246
1246
1247
1247
.. ipython:: python
@@ -1252,13 +1252,13 @@ values, index and columns. Name is also included for ``Series``:
1252
1252
.. note::
1253
1253
1254
1254
Any orient option that encodes to a JSON object will not preserve the ordering of
1255
-
index and column labels during round-trip serialisation. If you wish to preserve
1255
+
index and column labels during round-trip serialization. If you wish to preserve
1256
1256
label ordering use the `split` option as it uses ordered containers.
1257
1257
1258
1258
Date Handling
1259
1259
+++++++++++++
1260
1260
1261
-
Writing in iso date format
1261
+
Writing in ISO date format
1262
1262
1263
1263
.. ipython:: python
1264
1264
@@ -1268,7 +1268,7 @@ Writing in iso date format
1268
1268
json = dfd.to_json(date_format='iso')
1269
1269
json
1270
1270
1271
-
Writing in iso date format, with microseconds
1271
+
Writing in ISO date format, with microseconds
1272
1272
1273
1273
.. ipython:: python
1274
1274
@@ -1297,17 +1297,17 @@ Writing to a file, with a date index and a date column
1297
1297
Fallback Behavior
1298
1298
+++++++++++++++++
1299
1299
1300
-
If the JSON serialiser cannot handle the container contents directly it will fallback in the following manner:
1300
+
If the JSON serializer cannot handle the container contents directly it will fallback in the following manner:
1301
1301
1302
1302
- if a ``toDict`` method is defined by the unrecognised object then that
1303
-
will be called and its returned ``dict`` will be JSON serialised.
1303
+
will be called and its returned ``dict`` will be JSON serialized.
1304
1304
- if a ``default_handler`` has been passed to ``to_json`` that will
1305
1305
be called to convert the object.
1306
1306
- otherwise an attempt is made to convert the object to a ``dict`` by
1307
1307
parsing its contents. However if the object is complex this will often fail
1308
1308
with an ``OverflowError``.
1309
1309
1310
-
Your best bet when encountering ``OverflowError`` during serialisation
1310
+
Your best bet when encountering ``OverflowError`` during serialization
1311
1311
is to specify a ``default_handler``. For example ``timedelta`` can cause
1312
1312
problems:
1313
1313
@@ -1349,7 +1349,7 @@ The parser will try to parse a ``DataFrame`` if ``typ`` is not supplied or
1349
1349
is ``None``. To explicitly force ``Series`` parsing, pass ``typ=series``
1350
1350
1351
1351
- ``filepath_or_buffer`` : a **VALID** JSON string or file handle / StringIO. The string could be
1352
-
a URL. Valid URL schemes include http, ftp, s3, and file. For file URLs, a host
1352
+
a URL. Valid URL schemes include http, ftp, S3, and file. For file URLs, a host
1353
1353
is expected. For instance, a local file could be
1354
1354
file ://localhost/path/to/table.json
1355
1355
- ``typ`` : type of object to recover (series or frame), default 'frame'
@@ -1480,7 +1480,7 @@ The Numpy Parameter
1480
1480
This supports numeric data only. Index and columns labels may be non-numeric, e.g. strings, dates etc.
1481
1481
1482
1482
If ``numpy=True`` is passed to ``read_json`` an attempt will be made to sniff
1483
-
an appropriate dtype during deserialisation and to subsequently decode directly
1483
+
an appropriate dtype during deserialization and to subsequently decode directly
1484
1484
to numpy arrays, bypassing the need for intermediate Python objects.
1485
1485
1486
1486
This can provide speedups if you are deserialising a large amount of numeric
@@ -1586,7 +1586,7 @@ Reading HTML Content
1586
1586
.. versionadded:: 0.12.0
1587
1587
1588
1588
The top-level :func:`~pandas.io.html.read_html` function can accept an HTML
1589
-
string/file/url and will parse HTML tables into list of pandas DataFrames.
1589
+
string/file/URL and will parse HTML tables into list of pandas DataFrames.
0 commit comments