Skip to content

Commit 5c8a3aa

Browse files
committed
Fix docstrings
1 parent 0b0b072 commit 5c8a3aa

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

pandas/io/parsers.py

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
delimiters are prone to ignoring quoted data. Regex example: ``'\r\t'``.
8585
delimiter : str, default ``None``
8686
Alias for sep.
87-
header : int or list of ints, default 'infer'
87+
header : int, list of int, default 'infer'
8888
Row number(s) to use as the column names, and the start of the
8989
data. Default behavior is to infer the column names: if no names
9090
are passed the behavior is identical to ``header=0`` and column
@@ -98,16 +98,16 @@
9898
parameter ignores commented lines and empty lines if
9999
``skip_blank_lines=True``, so ``header=0`` denotes the first line of
100100
data rather than the first line of the file.
101-
names : array-like, default None
101+
names : array-like, optional
102102
List of column names to use. If file contains no header row, then you
103103
should explicitly pass ``header=None``. Duplicates in this list will cause
104104
a ``UserWarning`` to be issued.
105-
index_col : int or sequence or False, default None
105+
index_col : int, sequence or bool, optional
106106
Column to use as the row labels of the DataFrame. If a sequence is given, a
107107
MultiIndex is used. If you have a malformed file with delimiters at the end
108108
of each line, you might consider ``index_col=False`` to force pandas to
109109
not use the first column as the index (row names).
110-
usecols : list-like or callable, default None
110+
usecols : list-like or callable, optional
111111
Return a subset of the columns. If list-like, all elements must either
112112
be positional (i.e. integer indices into the document columns) or strings
113113
that correspond to column names provided either by the user in `names` or
@@ -127,13 +127,13 @@
127127
parsing time and lower memory usage.
128128
squeeze : bool, default False
129129
If the parsed data only contains one column then return a Series.
130-
prefix : str, default None
130+
prefix : str, optional
131131
Prefix to add to column numbers when no header, e.g. 'X' for X0, X1, ...
132132
mangle_dupe_cols : bool, default True
133133
Duplicate columns will be specified as 'X', 'X.1', ...'X.N', rather than
134134
'X'...'X'. Passing in False will cause data to be overwritten if there
135135
are duplicate names in the columns.
136-
dtype : Type name or dict of column -> type, default None
136+
dtype : Type name or dict of column -> type, optional
137137
Data type for data or columns. E.g. {{'a': np.float64, 'b': np.int32}}
138138
Use `str` or `object` together with suitable `na_values` settings
139139
to preserve and not interpret dtype.
@@ -142,16 +142,16 @@
142142
engine : {{'c', 'python'}}, optional
143143
Parser engine to use. The C engine is faster while the python engine is
144144
currently more feature-complete.
145-
converters : dict, default None
145+
converters : dict, optional
146146
Dict of functions for converting values in certain columns. Keys can either
147147
be integers or column labels.
148-
true_values : list, default None
148+
true_values : list, optional
149149
Values to consider as True.
150-
false_values : list, default None
150+
false_values : list, optional
151151
Values to consider as False.
152152
skipinitialspace : bool, default False
153153
Skip spaces after delimiter.
154-
skiprows : list-like or int or callable, default None
154+
skiprows : list-like, int or callable, optional
155155
Line numbers to skip (0-indexed) or number of lines to skip (int)
156156
at the start of the file.
157157
@@ -160,9 +160,9 @@
160160
An example of a valid callable argument would be ``lambda x: x in [0, 2]``.
161161
skipfooter : int, default 0
162162
Number of lines at bottom of file to skip (Unsupported with engine='c').
163-
nrows : int, default None
163+
nrows : int, optional
164164
Number of rows of file to read. Useful for reading pieces of large files.
165-
na_values : scalar, str, list-like, or dict, default None
165+
na_values : scalar, str, list-like, or dict, optional
166166
Additional strings to recognize as NA/NaN. If dict passed, specific
167167
per-column NA values. By default the following values are interpreted as
168168
NaN: '""" + fill("', '".join(sorted(_NA_VALUES)),
@@ -190,12 +190,12 @@
190190
Indicate number of NA values placed in non-numeric columns.
191191
skip_blank_lines : bool, default True
192192
If True, skip over blank lines rather than interpreting as NaN values.
193-
parse_dates : bool or list of ints or names or list of lists or dict, \
193+
parse_dates : bool or list of int or names or list of lists or dict, \
194194
default False
195195
The behavior is as follows:
196196
197197
* boolean. If True -> try parsing the index.
198-
* list of ints or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3
198+
* list of int or names. e.g. If [1, 2, 3] -> try parsing columns 1, 2, 3
199199
each as a separate date column.
200200
* list of lists. e.g. If [[1, 3]] -> combine columns 1 and 3 and parse as
201201
a single date column.
@@ -215,7 +215,7 @@
215215
keep_date_col : bool, default False
216216
If True and `parse_dates` specifies combining multiple columns then
217217
keep the original columns.
218-
date_parser : function, default None
218+
date_parser : function, optional
219219
Function to use for converting a sequence of string columns to an array of
220220
datetime instances. The default uses ``dateutil.parser.parser`` to do the
221221
conversion. Pandas will try to call `date_parser` in three different ways,
@@ -230,7 +230,7 @@
230230
iterator : bool, default False
231231
Return TextFileReader object for iteration or getting chunks with
232232
``get_chunk()``.
233-
chunksize : int, default None
233+
chunksize : int, optional
234234
Return TextFileReader object for iteration.
235235
See the `IO Tools docs
236236
<http://pandas.pydata.org/pandas-docs/stable/io.html#io-chunking>`_
@@ -244,11 +244,11 @@
244244
245245
.. versionadded:: 0.18.1 support for 'zip' and 'xz' compression.
246246
247-
thousands : str, default None
247+
thousands : str, optional
248248
Thousands separator.
249249
decimal : str, default '.'
250250
Character to recognize as decimal point (e.g. use ',' for European data).
251-
lineterminator : str (length 1), default None
251+
lineterminator : str (length 1), optional
252252
Character to break file into lines. Only valid with C parser.
253253
quotechar : str (length 1), optional
254254
The character used to denote the start and end of a quoted item. Quoted
@@ -260,21 +260,21 @@
260260
When quotechar is specified and quoting is not ``QUOTE_NONE``, indicate
261261
whether or not to interpret two consecutive quotechar elements INSIDE a
262262
field as a single ``quotechar`` element.
263-
escapechar : str (length 1), default None
263+
escapechar : str (length 1), optional
264264
One-character string used to escape delimiter when quoting is QUOTE_NONE.
265-
comment : str, default None
265+
comment : str, optional
266266
Indicates remainder of line should not be parsed. If found at the beginning
267267
of a line, the line will be ignored altogether. This parameter must be a
268268
single character. Like empty lines (as long as ``skip_blank_lines=True``),
269269
fully commented lines are ignored by the parameter `header` but not by
270270
`skiprows`. For example, if ``comment='#'``, parsing
271271
``#empty\\na,b,c\\n1,2,3`` with ``header=0`` will result in 'a,b,c' being
272272
treated as the header.
273-
encoding : str, default None
273+
encoding : str, optional
274274
Encoding to use for UTF when reading/writing (ex. 'utf-8'). `List of Python
275275
standard encodings
276276
<https://docs.python.org/3/library/codecs.html#standard-encodings>`_ .
277-
dialect : str or csv.Dialect instance, default None
277+
dialect : str or csv.Dialect, optional
278278
If provided, this parameter will override values (default or not) for the
279279
following parameters: `delimiter`, `doublequote`, `escapechar`,
280280
`skipinitialspace`, `quotechar`, and `quoting`. If it is necessary to
@@ -743,13 +743,13 @@ def read_fwf(filepath_or_buffer, colspecs='infer',
743743
By file-like object, we refer to objects with a ``read()`` method,
744744
such as a file handler (e.g. via builtin ``open`` function)
745745
or ``StringIO``.
746-
colspecs : list of pairs (int, int) or 'infer'. optional
747-
A list of pairs (tuples) giving the extents of the fixed-width
746+
colspecs : list of tuple (int, int) or 'infer'. optional
747+
A list of tuples giving the extents of the fixed-width
748748
fields of each line as half-open intervals (i.e., [from, to[ ).
749749
String value 'infer' can be used to instruct the parser to try
750750
detecting the column specifications from the first 100 rows of
751751
the data which are not being skipped via skiprows (default='infer').
752-
widths : list of ints. optional
752+
widths : list of int, optional
753753
A list of field widths which can be used instead of 'colspecs' if
754754
the intervals are contiguous.
755755
**kwds : optional
@@ -765,7 +765,6 @@ def read_fwf(filepath_or_buffer, colspecs='infer',
765765
--------
766766
to_csv : Write DataFrame to a comma-separated values (csv) file.
767767
read_csv : Read a comma-separated values (csv) file into DataFrame.
768-
read_fwf : Read a table of fixed-width formatted lines into DataFrame.
769768
770769
Examples
771770
--------
@@ -2055,45 +2054,45 @@ def TextParser(*args, **kwds):
20552054
----------
20562055
data : file-like object or list
20572056
delimiter : separator character to use
2058-
dialect : str or csv.Dialect instance, default None
2057+
dialect : str or csv.Dialect instance, optional
20592058
Ignored if delimiter is longer than 1 character
20602059
names : sequence, default
20612060
header : int, default 0
20622061
Row to use to parse column labels. Defaults to the first row. Prior
20632062
rows will be discarded
2064-
index_col : int or list, default None
2063+
index_col : int or list, optional
20652064
Column or columns to use as the (possibly hierarchical) index
20662065
has_index_names: bool, default False
20672066
True if the cols defined in index_col have an index name and are
20682067
not in the header.
2069-
na_values : scalar, str, list-like, or dict, default None
2068+
na_values : scalar, str, list-like, or dict, optional
20702069
Additional strings to recognize as NA/NaN.
20712070
keep_default_na : bool, default True
2072-
thousands : str, default None
2071+
thousands : str, optional
20732072
Thousands separator
2074-
comment : str, default None
2073+
comment : str, optional
20752074
Comment out remainder of line
20762075
parse_dates : bool, default False
20772076
keep_date_col : bool, default False
2078-
date_parser : function, default None
2077+
date_parser : function, optional
20792078
skiprows : list of integers
20802079
Row numbers to skip
20812080
skipfooter : int
20822081
Number of line at bottom of file to skip
2083-
converters : dict, default None
2082+
converters : dict, optional
20842083
Dict of functions for converting values in certain columns. Keys can
20852084
either be integers or column labels, values are functions that take one
20862085
input argument, the cell (not column) content, and return the
20872086
transformed content.
2088-
encoding : str, default None
2087+
encoding : str, optional
20892088
Encoding to use for UTF when reading/writing (ex. 'utf-8')
20902089
squeeze : bool, default False
20912090
returns Series if only one column.
20922091
infer_datetime_format: bool, default False
20932092
If True and `parse_dates` is True for a column, try to infer the
20942093
datetime format based on the first datetime string. If the format
20952094
can be inferred, there often will be a large parsing speed-up.
2096-
float_precision : str, default None
2095+
float_precision : str, optional
20972096
Specifies which converter the C engine should use for floating-point
20982097
values. The options are None for the ordinary converter,
20992098
'high' for the high-precision converter, and 'round_trip' for the

0 commit comments

Comments
 (0)