From d403debd716d0d4ba0873368869aa3285175672c Mon Sep 17 00:00:00 2001 From: SandroCasagrande Date: Wed, 27 Jul 2022 11:12:05 +0000 Subject: [PATCH 1/3] DOC: updated dtype doc in io user guide with content from docstring and fixed formatting --- doc/source/user_guide/io.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 7d1aa76613d33..e3b9bfc3c7926 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -182,15 +182,16 @@ General parsing configuration +++++++++++++++++++++++++++++ dtype : Type name or dict of column -> type, default ``None`` - Data type for data or columns. E.g. ``{'a': np.float64, 'b': np.int32}`` - (unsupported with ``engine='python'``). Use ``str`` or ``object`` together - with suitable ``na_values`` settings to preserve and - not interpret dtype. + Data type for data or columns. E.g. ``{'a': np.float64, 'b': np.int32, 'c': 'Int64'}`` + Use ``str`` or ``object`` together with suitable ``na_values`` settings to preserve + and not interpret dtype. If converters are specified, they will be applied INSTEAD + of dtype conversion. + .. versionadded:: 1.5.0 - Support for defaultdict was added. Specify a defaultdict as input where - the default determines the dtype of the columns which are not explicitly - listed. + Support for defaultdict was added. Specify a defaultdict as input where + the default determines the dtype of the columns which are not explicitly + listed. engine : {``'c'``, ``'python'``, ``'pyarrow'``} Parser engine to use. The C and pyarrow engines are faster, while the python engine is currently more feature-complete. Multithreading is currently only supported by From f145d5c40ca08f7b3a38a91688cf741bcd632bfb Mon Sep 17 00:00:00 2001 From: SandroCasagrande Date: Wed, 27 Jul 2022 11:45:11 +0000 Subject: [PATCH 2/3] DOC: introduced sphinx note directive --- doc/source/user_guide/io.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index e3b9bfc3c7926..d2d3ceadb8cd0 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -107,9 +107,10 @@ index_col : int, str, sequence of int / str, or False, optional, default ``None` string name or column index. If a sequence of int / str is given, a MultiIndex is used. - Note: ``index_col=False`` can be used to force pandas to *not* use the first - column as the index, e.g. when you have a malformed file with delimiters at - the end of each line. + .. note:: + ``index_col=False`` can be used to force pandas to *not* use the first + column as the index, e.g. when you have a malformed file with delimiters at + the end of each line. The default value of ``None`` instructs pandas to guess. If the number of fields in the column header row is equal to the number of fields in the body @@ -1594,8 +1595,10 @@ of multi-columns indices. pd.read_csv("mi2.csv", header=[0, 1], index_col=0) -Note: If an ``index_col`` is not specified (e.g. you don't have an index, or wrote it -with ``df.to_csv(..., index=False)``, then any ``names`` on the columns index will be *lost*. +.. note:: + If an ``index_col`` is not specified (e.g. you don't have an index, or wrote it + with ``df.to_csv(..., index=False)``, then any ``names`` on the columns index will + be *lost*. .. ipython:: python :suppress: From e0c072a282fc26500e8f52f6c7ab02f79ec9533a Mon Sep 17 00:00:00 2001 From: SandroCasagrande Date: Wed, 27 Jul 2022 11:50:41 +0000 Subject: [PATCH 3/3] DOC: fixed formatting --- doc/source/user_guide/io.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index d2d3ceadb8cd0..25625dba1080f 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -285,7 +285,9 @@ parse_dates : boolean or list of ints or names or list of lists or dict, default * If ``[[1, 3]]`` -> combine columns 1 and 3 and parse as a single date column. * If ``{'foo': [1, 3]}`` -> parse columns 1, 3 as date and call result 'foo'. - A fast-path exists for iso8601-formatted dates. + + .. note:: + A fast-path exists for iso8601-formatted dates. infer_datetime_format : boolean, default ``False`` If ``True`` and parse_dates is enabled for a column, attempt to infer the datetime format to speed up the processing.