Skip to content

Commit 8dc70ff

Browse files
tolaa001proost
authored andcommitted
PR06 doc string fixes (pandas-dev#28946)
1 parent e361fdf commit 8dc70ff

File tree

17 files changed

+32
-31
lines changed

17 files changed

+32
-31
lines changed

pandas/core/computation/eval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ def eval(
198198
<https://docs.python.org/3/reference/simple_stmts.html#simple-statements>`__,
199199
only Python `expressions
200200
<https://docs.python.org/3/reference/simple_stmts.html#expression-statements>`__.
201-
parser : string, default 'pandas', {'pandas', 'python'}
201+
parser : {'pandas', 'python'}, default 'pandas'
202202
The parser to use to construct the syntax tree from the expression. The
203203
default of ``'pandas'`` parses code slightly different than standard
204204
Python. Alternatively, you can parse an expression using the
205205
``'python'`` parser to retain strict Python semantics. See the
206206
:ref:`enhancing performance <enhancingperf.eval>` documentation for
207207
more details.
208-
engine : string or None, default 'numexpr', {'python', 'numexpr'}
208+
engine : {'python', 'numexpr'}, default 'numexpr'
209209
210210
The engine used to evaluate the expression. Supported engines are
211211

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6238,7 +6238,7 @@ def unstack(self, level=-1, fill_value=None):
62386238
----------
62396239
level : int, str, or list of these, default -1 (last level)
62406240
Level(s) of index to unstack, can pass level name.
6241-
fill_value : int, string or dict
6241+
fill_value : int, str or dict
62426242
Replace NaN with this value if the unstack produces missing values.
62436243
62446244
Returns

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,7 @@ def to_json(
23532353
23542354
.. versionadded:: 0.23.0
23552355
2356-
indent : integer, optional
2356+
indent : int, optional
23572357
Length of whitespace used to indent each record.
23582358
23592359
.. versionadded:: 1.0.0

pandas/core/groupby/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,7 @@ def nunique(self, dropna=True):
16441644
16451645
Parameters
16461646
----------
1647-
dropna : boolean, default True
1647+
dropna : bool, default True
16481648
Don't include NaN in the counts.
16491649
16501650
Returns

pandas/core/indexes/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4531,7 +4531,7 @@ def shift(self, periods=1, freq=None):
45314531
periods : int, default 1
45324532
Number of periods (or increments) to shift by,
45334533
can be positive or negative.
4534-
freq : pandas.DateOffset, pandas.Timedelta or string, optional
4534+
freq : pandas.DateOffset, pandas.Timedelta or str, optional
45354535
Frequency increment to shift by.
45364536
If None, the index is shifted by its own `freq` attribute.
45374537
Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc.

pandas/core/indexes/category.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class CategoricalIndex(Index, accessor.PandasDelegate):
7777
Whether or not this categorical is treated as an ordered
7878
categorical. If not given here or in `dtype`, the resulting
7979
categorical will be unordered.
80-
dtype : CategoricalDtype or the string "category", optional
80+
dtype : CategoricalDtype or "category", optional
8181
If :class:`CategoricalDtype`, cannot be used together with
8282
`categories` or `ordered`.
8383

pandas/core/indexes/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ def indexer_at_time(self, time, asof=False):
13281328
13291329
Parameters
13301330
----------
1331-
time : datetime.time or string
1331+
time : datetime.time or str
13321332
datetime.time or string in appropriate format ("%H:%M", "%H%M",
13331333
"%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p",
13341334
"%I%M%S%p").

pandas/core/indexes/interval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1412,11 +1412,11 @@ def interval_range(
14121412
Right bound for generating intervals
14131413
periods : int, default None
14141414
Number of periods to generate
1415-
freq : numeric, string, or DateOffset, default None
1415+
freq : numeric, str, or DateOffset, default None
14161416
The length of each interval. Must be consistent with the type of start
14171417
and end, e.g. 2 for numeric, or '5H' for datetime-like. Default is 1
14181418
for numeric and 'D' for datetime-like.
1419-
name : string, default None
1419+
name : str, default None
14201420
Name of the resulting IntervalIndex
14211421
closed : {'left', 'right', 'both', 'neither'}, default 'right'
14221422
Whether the intervals are closed on the left-side, right-side, both

pandas/core/indexes/multi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ def to_frame(self, index=True, name=None):
16531653
16541654
Parameters
16551655
----------
1656-
index : boolean, default True
1656+
index : bool, default True
16571657
Set the index of the returned DataFrame as the original MultiIndex.
16581658
16591659
name : list / sequence of strings, optional
@@ -2337,7 +2337,7 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True):
23372337
level : list-like, int or str, default 0
23382338
If a string is given, must be a name of the level
23392339
If list-like must be names or ints of levels.
2340-
ascending : boolean, default True
2340+
ascending : bool, default True
23412341
False to sort in descending order
23422342
Can also be a list to specify a directed ordering
23432343
sort_remaining : sort by the remaining levels after level

pandas/core/reshape/tile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ def qcut(x, q, labels=None, retbins=False, precision=3, duplicates="raise"):
285285
Parameters
286286
----------
287287
x : 1d ndarray or Series
288-
q : integer or array of quantiles
288+
q : int or list-like of int
289289
Number of quantiles. 10 for deciles, 4 for quartiles, etc. Alternately
290290
array of quantiles, e.g. [0, .25, .5, .75, 1.] for quartiles
291-
labels : array or boolean, default None
291+
labels : array or bool, default None
292292
Used as labels for the resulting bins. Must be of the same length as
293293
the resulting bins. If False, return only integer indicators of the
294294
bins.

pandas/core/tools/numeric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def to_numeric(arg, errors="raise", downcast=None):
3939
- If 'raise', then invalid parsing will raise an exception
4040
- If 'coerce', then invalid parsing will be set as NaN
4141
- If 'ignore', then invalid parsing will return the input
42-
downcast : {'integer', 'signed', 'unsigned', 'float'} , default None
42+
downcast : {'integer', 'signed', 'unsigned', 'float'}, default None
4343
If not None, and if the data has been successfully cast to a
4444
numerical dtype (or if the data was numeric to begin with),
4545
downcast that resulting data to the smallest numerical dtype

pandas/io/json/_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def read_json(
384384
By file-like object, we refer to objects with a ``read()`` method,
385385
such as a file handler (e.g. via builtin ``open`` function)
386386
or ``StringIO``.
387-
orient : string,
387+
orient : str
388388
Indication of expected JSON string format.
389389
Compatible JSON strings can be produced by ``to_json()`` with a
390390
corresponding orient value.

pandas/io/parsers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
arguments.
258258
dayfirst : bool, default False
259259
DD/MM format dates, international and European format.
260-
cache_dates : boolean, default True
260+
cache_dates : bool, default True
261261
If True, use a cache of unique, converted dates to apply the datetime
262262
conversion. May produce significant speed-up when parsing duplicate
263263
date strings, especially ones with timezone offsets.

pandas/io/pytables.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,8 @@ def append(
10251025
Write as a PyTables Table structure which may perform
10261026
worse but allow more flexible operations like searching
10271027
/ selecting subsets of the data
1028-
append : boolean, default True, append the input data to the
1029-
existing
1028+
append : bool, default True
1029+
Append the input data to the existing.
10301030
data_columns : list of columns, or True, default None
10311031
List of columns to create as indexed data columns for on-disk
10321032
queries, or True to use all columns. By default only the axes
@@ -1037,8 +1037,9 @@ def append(
10371037
chunksize : size to chunk the writing
10381038
expectedrows : expected TOTAL row size of this table
10391039
encoding : default None, provide an encoding for strings
1040-
dropna : boolean, default False, do not write an ALL nan row to
1041-
the store settable by the option 'io.hdf.dropna_table'
1040+
dropna : bool, default False
1041+
Do not write an ALL nan row to the store settable
1042+
by the option 'io.hdf.dropna_table'.
10421043
10431044
Notes
10441045
-----

pandas/io/sql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def read_sql_query(
287287
If a DBAPI2 object, only sqlite3 is supported.
288288
index_col : string or list of strings, optional, default: None
289289
Column(s) to set as index(MultiIndex).
290-
coerce_float : boolean, default True
290+
coerce_float : bool, default True
291291
Attempts to convert values of non-string, non-numeric objects (like
292292
decimal.Decimal) to floating point. Useful for SQL result sets.
293293
params : list, tuple or dict, optional, default: None

pandas/io/stata.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,31 @@
5353
)
5454

5555
_statafile_processing_params1 = """\
56-
convert_dates : boolean, defaults to True
56+
convert_dates : bool, default True
5757
Convert date variables to DataFrame time values.
58-
convert_categoricals : boolean, defaults to True
58+
convert_categoricals : bool, default True
5959
Read value labels and convert columns to Categorical/Factor variables."""
6060

6161
_encoding_params = """\
62-
encoding : string, None or encoding
62+
encoding : str, None or encoding
6363
Encoding used to parse the files. None defaults to latin-1."""
6464

6565
_statafile_processing_params2 = """\
66-
index_col : string, optional, default: None
66+
index_col : str, optional
6767
Column to set as index.
68-
convert_missing : boolean, defaults to False
68+
convert_missing : bool, default False
6969
Flag indicating whether to convert missing values to their Stata
7070
representations. If False, missing values are replaced with nan.
7171
If True, columns containing missing values are returned with
7272
object data types and missing values are represented by
7373
StataMissingValue objects.
74-
preserve_dtypes : boolean, defaults to True
74+
preserve_dtypes : bool, default True
7575
Preserve Stata datatypes. If False, numeric data are upcast to pandas
7676
default types for foreign data (float64 or int64).
7777
columns : list or None
7878
Columns to retain. Columns will be returned in the given order. None
7979
returns all columns.
80-
order_categoricals : boolean, defaults to True
80+
order_categoricals : bool, default True
8181
Flag indicating whether converted categorical data are ordered."""
8282

8383
_chunksize_params = """\
@@ -86,7 +86,7 @@
8686
given number of lines."""
8787

8888
_iterator_params = """\
89-
iterator : boolean, default False
89+
iterator : bool, default False
9090
Return StataReader object."""
9191

9292
_read_stata_doc = """

pandas/tseries/frequencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def infer_freq(index, warn=True):
223223
----------
224224
index : DatetimeIndex or TimedeltaIndex
225225
if passed a Series will use the values of the series (NOT THE INDEX)
226-
warn : boolean, default True
226+
warn : bool, default True
227227
228228
Returns
229229
-------

0 commit comments

Comments
 (0)