Skip to content

Commit b7b2e9b

Browse files
authored
DOC: Some minor doc cleanups (#44440)
1 parent af89b86 commit b7b2e9b

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

doc/source/user_guide/io.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ header : int or list of ints, default ``'infer'``
102102
names : array-like, default ``None``
103103
List of column names to use. If file contains no header row, then you should
104104
explicitly pass ``header=None``. Duplicates in this list are not allowed.
105-
index_col : int, str, sequence of int / str, or False, default ``None``
105+
index_col : int, str, sequence of int / str, or False, optional, default ``None``
106106
Column(s) to use as the row labels of the ``DataFrame``, either given as
107107
string name or column index. If a sequence of int / str is given, a
108108
MultiIndex is used.
@@ -120,7 +120,8 @@ usecols : list-like or callable, default ``None``
120120
Return a subset of the columns. If list-like, all elements must either
121121
be positional (i.e. integer indices into the document columns) or strings
122122
that correspond to column names provided either by the user in ``names`` or
123-
inferred from the document header row(s). For example, a valid list-like
123+
inferred from the document header row(s). If ``names`` are given, the document
124+
header row(s) are not taken into account. For example, a valid list-like
124125
``usecols`` parameter would be ``[0, 1, 2]`` or ``['foo', 'bar', 'baz']``.
125126

126127
Element order is ignored, so ``usecols=[0, 1]`` is the same as ``[1, 0]``. To
@@ -348,7 +349,7 @@ dialect : str or :class:`python:csv.Dialect` instance, default ``None``
348349
Error handling
349350
++++++++++++++
350351

351-
error_bad_lines : boolean, default ``None``
352+
error_bad_lines : boolean, optional, default ``None``
352353
Lines with too many fields (e.g. a csv line with too many commas) will by
353354
default cause an exception to be raised, and no ``DataFrame`` will be
354355
returned. If ``False``, then these "bad lines" will dropped from the
@@ -358,7 +359,7 @@ error_bad_lines : boolean, default ``None``
358359
.. deprecated:: 1.3.0
359360
The ``on_bad_lines`` parameter should be used instead to specify behavior upon
360361
encountering a bad line instead.
361-
warn_bad_lines : boolean, default ``None``
362+
warn_bad_lines : boolean, optional, default ``None``
362363
If error_bad_lines is ``False``, and warn_bad_lines is ``True``, a warning for
363364
each "bad line" will be output.
364365

pandas/core/frame.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1044,12 +1044,14 @@ def _repr_html_(self) -> str | None:
10441044
return None
10451045

10461046
@Substitution(
1047-
header_type="bool or sequence",
1047+
header_type="bool or sequence of strings",
10481048
header="Write out the column names. If a list of strings "
10491049
"is given, it is assumed to be aliases for the "
10501050
"column names",
10511051
col_space_type="int, list or dict of int",
1052-
col_space="The minimum width of each column",
1052+
col_space="The minimum width of each column. If a list of ints is given "
1053+
"every integers corresponds with one column. If a dict is given, the key "
1054+
"references the column, while the value defines the space to use.",
10531055
)
10541056
@Substitution(shared_params=fmt.common_docstring, returns=fmt.return_docstring)
10551057
def to_string(

pandas/core/indexes/base.py

-14
Original file line numberDiff line numberDiff line change
@@ -6681,8 +6681,6 @@ def all(self, *args, **kwargs):
66816681
66826682
Examples
66836683
--------
6684-
**all**
6685-
66866684
True, because nonzero integers are considered True.
66876685
66886686
>>> pd.Index([1, 2, 3]).all()
@@ -6692,18 +6690,6 @@ def all(self, *args, **kwargs):
66926690
66936691
>>> pd.Index([0, 1, 2]).all()
66946692
False
6695-
6696-
**any**
6697-
6698-
True, because ``1`` is considered True.
6699-
6700-
>>> pd.Index([0, 0, 1]).any()
6701-
True
6702-
6703-
False, because ``0`` is considered False.
6704-
6705-
>>> pd.Index([0, 0, 0]).any()
6706-
False
67076693
"""
67086694
nv.validate_all(args, kwargs)
67096695
self._maybe_disable_logical_methods("all")

pandas/io/parsers/readers.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
List of column names to use. If the file contains a header row,
105105
then you should explicitly pass ``header=0`` to override the column names.
106106
Duplicates in this list are not allowed.
107-
index_col : int, str, sequence of int / str, or False, default ``None``
107+
index_col : int, str, sequence of int / str, or False, optional, default ``None``
108108
Column(s) to use as the row labels of the ``DataFrame``, either given as
109109
string name or column index. If a sequence of int / str is given, a
110110
MultiIndex is used.
@@ -116,7 +116,8 @@
116116
Return a subset of the columns. If list-like, all elements must either
117117
be positional (i.e. integer indices into the document columns) or strings
118118
that correspond to column names provided either by the user in `names` or
119-
inferred from the document header row(s). For example, a valid list-like
119+
inferred from the document header row(s). If ``names`` are given, the document
120+
header row(s) are not taken into account. For example, a valid list-like
120121
`usecols` parameter would be ``[0, 1, 2]`` or ``['foo', 'bar', 'baz']``.
121122
Element order is ignored, so ``usecols=[0, 1]`` is the same as ``[1, 0]``.
122123
To instantiate a DataFrame from ``data`` with element order preserved use
@@ -331,7 +332,7 @@
331332
`skipinitialspace`, `quotechar`, and `quoting`. If it is necessary to
332333
override values, a ParserWarning will be issued. See csv.Dialect
333334
documentation for more details.
334-
error_bad_lines : bool, default ``None``
335+
error_bad_lines : bool, optional, default ``None``
335336
Lines with too many fields (e.g. a csv line with too many commas) will by
336337
default cause an exception to be raised, and no DataFrame will be returned.
337338
If False, then these "bad lines" will be dropped from the DataFrame that is
@@ -340,7 +341,7 @@
340341
.. deprecated:: 1.3.0
341342
The ``on_bad_lines`` parameter should be used instead to specify behavior upon
342343
encountering a bad line instead.
343-
warn_bad_lines : bool, default ``None``
344+
warn_bad_lines : bool, optional, default ``None``
344345
If error_bad_lines is False, and warn_bad_lines is True, a warning for each
345346
"bad line" will be output.
346347

0 commit comments

Comments
 (0)