diff --git a/pandas/core/frame.py b/pandas/core/frame.py index ed05691d33d07..e4a44a89998e3 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -322,7 +322,7 @@ class DataFrame(NDFrame): RangeIndex (0, 1, 2, ..., n) if no column labels are provided dtype : dtype, default None Data type to force. Only a single dtype is allowed. If None, infer - copy : boolean, default False + copy : bool, default False Copy data from inputs. Only affects DataFrame / 2d ndarray input See Also @@ -1542,7 +1542,7 @@ def from_records( Parameters ---------- data : ndarray (structured dtype), list of tuples, dict, or DataFrame - index : string, list of fields, array-like + index : str, list of fields, array-like Field of array to use as the index, alternately a specific set of input labels to use exclude : sequence, default None @@ -1553,7 +1553,7 @@ def from_records( columns. Otherwise this argument indicates the order of the columns in the result (any names not found in the data will become all-NA columns) - coerce_float : boolean, default False + coerce_float : bool, default False Attempt to convert values of non-string, non-numeric objects (like decimal.Decimal) to floating point, useful for SQL result sets nrows : int, default None @@ -3461,7 +3461,7 @@ def insert(self, loc, column, value, allow_duplicates=False): ---------- loc : int Insertion index. Must verify 0 <= loc <= len(columns) - column : string, number, or hashable object + column : str, number, or hashable object label of the inserted column value : int, Series, or array-like allow_duplicates : bool, optional @@ -4775,7 +4775,7 @@ def drop_duplicates(self, subset=None, keep="first", inplace=False): - ``first`` : Drop duplicates except for the first occurrence. - ``last`` : Drop duplicates except for the last occurrence. - False : Drop all duplicates. - inplace : boolean, default False + inplace : bool, default False Whether to drop duplicates in place or to return a copy Returns @@ -5197,7 +5197,7 @@ def swaplevel(self, i=-2, j=-1, axis=0): Parameters ---------- - i, j : int, string (can be mixed) + i, j : int, str (can be mixed) Level of index to be swapped. Can pass level name as string. Returns @@ -5723,12 +5723,12 @@ def update( Parameters ----------%s - index : string or object, optional + index : str or object, optional Column to use to make new frame's index. If None, uses existing index. - columns : string or object + columns : str or object Column to use to make new frame's columns. - values : string, object or a list of the previous, optional + values : str, object or a list of the previous, optional Column(s) to use for populating new frame's values. If not specified, all remaining columns will be used and the result will have hierarchically indexed columns. @@ -5850,14 +5850,14 @@ def pivot(self, index=None, columns=None, values=None): is function or list of functions fill_value : scalar, default None Value to replace missing values with - margins : boolean, default False + margins : bool, default False Add all row / columns (e.g. for subtotal / grand totals) - dropna : boolean, default True + dropna : bool, default True Do not include columns whose entries are all NaN - margins_name : string, default 'All' + margins_name : str, default 'All' Name of the row / column that will contain the totals when margins is True. - observed : boolean, default False + observed : bool, default False This only applies if any of the groupers are Categoricals. If True: only show observed values for categorical groupers. If False: show all values for categorical groupers. @@ -6231,7 +6231,7 @@ def unstack(self, level=-1, fill_value=None): Parameters ---------- - level : int, string, or list of these, default -1 (last level) + level : int, str, or list of these, default -1 (last level) Level(s) of index to unstack, can pass level name fill_value : replace NaN with this value if the unstack produces missing values @@ -6305,7 +6305,7 @@ def unstack(self, level=-1, fill_value=None): ``frame.columns.name`` or 'variable'. value_name : scalar, default 'value' Name to use for the 'value' column. - col_level : int or string, optional + col_level : int or str, optional If columns are a MultiIndex then use this level to melt. Returns @@ -6894,11 +6894,11 @@ def append(self, other, ignore_index=False, verify_integrity=False, sort=None): ---------- other : DataFrame or Series/dict-like object, or list of these The data to append. - ignore_index : boolean, default False + ignore_index : bool, default False If True, do not use the index labels. - verify_integrity : boolean, default False + verify_integrity : bool, default False If True, raise ValueError on creating index with duplicates. - sort : boolean, default None + sort : bool, default None Sort columns if the columns of `self` and `other` are not aligned. The default sorting is deprecated and will change to not-sorting in a future version of pandas. Explicitly pass ``sort=True`` to @@ -7940,7 +7940,7 @@ def idxmin(self, axis=0, skipna=True): ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 0 or 'index' for row-wise, 1 or 'columns' for column-wise - skipna : boolean, default True + skipna : bool, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. @@ -7977,7 +7977,7 @@ def idxmax(self, axis=0, skipna=True): ---------- axis : {0 or 'index', 1 or 'columns'}, default 0 0 or 'index' for row-wise, 1 or 'columns' for column-wise - skipna : boolean, default True + skipna : bool, default True Exclude NA/null values. If an entire row/column is NA, the result will be NA. diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index e010e615e176e..6facbe7e01c57 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -1032,7 +1032,7 @@ class GroupBy(_GroupBy): Most users should ignore this exclusions : array-like, optional List of columns to exclude - name : string + name : str Most users should ignore this Returns @@ -1253,7 +1253,7 @@ def std(self, ddof=1, *args, **kwargs): Parameters ---------- - ddof : integer, default 1 + ddof : int, default 1 degrees of freedom Returns @@ -1276,7 +1276,7 @@ def var(self, ddof=1, *args, **kwargs): Parameters ---------- - ddof : integer, default 1 + ddof : int, default 1 degrees of freedom Returns @@ -1311,7 +1311,7 @@ def sem(self, ddof=1): Parameters ---------- - ddof : integer, default 1 + ddof : int, default 1 degrees of freedom Returns @@ -1623,7 +1623,7 @@ def pad(self, limit=None): Parameters ---------- - limit : integer, optional + limit : int, optional limit of how many values to fill Returns @@ -1649,7 +1649,7 @@ def backfill(self, limit=None): Parameters ---------- - limit : integer, optional + limit : int, optional limit of how many values to fill Returns @@ -2099,13 +2099,13 @@ def rank( * max: highest rank in group * first: ranks assigned in order they appear in the array * dense: like 'min', but rank always increases by 1 between groups - ascending : boolean, default True + ascending : bool, default True False for ranks by high (1) to low (N) na_option : {'keep', 'top', 'bottom'}, default 'keep' * keep: leave NA values where they are * top: smallest rank if ascending * bottom: smallest rank if descending - pct : boolean, default False + pct : bool, default False Compute percentage rank of data within each group axis : int, default 0 The axis of the object over which to compute the rank. @@ -2313,7 +2313,7 @@ def shift(self, periods=1, freq=None, axis=0, fill_value=None): Parameters ---------- - periods : integer, default 1 + periods : int, default 1 number of periods to shift freq : frequency string axis : axis to shift, default 0 diff --git a/pandas/core/groupby/grouper.py b/pandas/core/groupby/grouper.py index 2ebfbed0b132a..2d37121d28308 100644 --- a/pandas/core/groupby/grouper.py +++ b/pandas/core/groupby/grouper.py @@ -48,17 +48,17 @@ class Grouper: Parameters ---------- - key : string, defaults to None + key : str, defaults to None groupby key, which selects the grouping column of the target level : name/number, defaults to None the level for the target index - freq : string / frequency object, defaults to None + freq : str / frequency object, defaults to None This will groupby the specified frequency if the target selection (via key or level) is a datetime-like object. For full specification of available frequencies, please see `here `_. axis : number/name of the axis, defaults to 0 - sort : boolean, default to False + sort : bool, default to False whether to sort the resulting labels closed : {'left' or 'right'} Closed end of interval. Only when `freq` parameter is passed. @@ -69,7 +69,7 @@ class Grouper: If grouper is PeriodIndex and `freq` parameter is passed. base : int, default 0 Only when `freq` parameter is passed. - loffset : string, DateOffset, timedelta object + loffset : str, DateOffset, timedelta object Only when `freq` parameter is passed. Returns diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 62662edb692a7..0b633602f3ed0 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -904,8 +904,8 @@ def repeat(self, repeats, axis=None): Parameters ---------- - name : string, optional - deep : boolean, default False + name : str, optional + deep : bool, default False dtype : numpy dtype or pandas type Returns @@ -1172,7 +1172,7 @@ def to_series(self, index=None, name=None): ---------- index : Index, optional index of resulting Series. If None, defaults to original index - name : string, optional + name : str, optional name of resulting Series. If None, defaults to name of original index @@ -1198,7 +1198,7 @@ def to_frame(self, index=True, name=None): Parameters ---------- - index : boolean, default True + index : bool, default True Set the index of the returned DataFrame as the original Index. name : object, default None @@ -1401,7 +1401,7 @@ def rename(self, name, inplace=False): ---------- name : label or list of labels Name(s) to set. - inplace : boolean, default False + inplace : bool, default False Modifies the object directly, instead of creating a new Index or MultiIndex. @@ -1494,7 +1494,7 @@ def sortlevel(self, level=None, ascending=True, sort_remaining=None): Parameters ---------- - ascending : boolean, default True + ascending : bool, default True False to sort in descending order level, sort_remaining are compat parameters @@ -3415,8 +3415,8 @@ def _reindex_non_unique(self, target): other : Index how : {'left', 'right', 'inner', 'outer'} level : int or level name, default None - return_indexers : boolean, default False - sort : boolean, default False + return_indexers : bool, default False + sort : bool, default False Sort the join keys lexicographically in the result Index. If False, the order of the join keys depends on the join type (how keyword) @@ -3942,7 +3942,7 @@ def memory_usage(self, deep=False): Parameters ---------- - cond : boolean array-like with the same length as self + cond : bool array-like with the same length as self other : scalar, or array-like Returns @@ -4924,7 +4924,7 @@ def slice_indexer(self, start=None, end=None, step=None, kind=None): end : label, default None If None, defaults to the end step : int, default None - kind : string, default None + kind : str, default None Returns ------- diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index cce390d98c037..0b20df38e7d42 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -106,7 +106,7 @@ class DatetimeIndex(DatetimeIndexOpsMixin, Int64Index, DatetimeDelegateMixin): Optional datetime-like data to construct index with copy : bool Make a copy of input ndarray - freq : string or pandas offset object, optional + freq : str or pandas offset object, optional One of pandas date offset strings or corresponding objects. The string 'infer' can be passed in order to set the frequency of the index as the inferred frequency upon creation @@ -129,7 +129,7 @@ class DatetimeIndex(DatetimeIndexOpsMixin, Int64Index, DatetimeDelegateMixin): .. deprecated:: 0.24.0 - closed : string or None, default None + closed : str or None, default None Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None) @@ -1371,8 +1371,8 @@ def indexer_between_time( datetime.time or string in appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p", "%I%M%S%p"). - include_start : boolean, default True - include_end : boolean, default True + include_start : bool, default True + include_end : bool, default True Returns ------- @@ -1435,7 +1435,7 @@ def date_range( Left bound for generating dates. end : str or datetime-like, optional Right bound for generating dates. - periods : integer, optional + periods : int, optional Number of periods to generate. freq : str or DateOffset, default 'D' Frequency strings can have multiples, e.g. '5H'. See @@ -1598,22 +1598,22 @@ def bdate_range( Parameters ---------- - start : string or datetime-like, default None + start : str or datetime-like, default None Left bound for generating dates. - end : string or datetime-like, default None + end : str or datetime-like, default None Right bound for generating dates. - periods : integer, default None + periods : int, default None Number of periods to generate. - freq : string or DateOffset, default 'B' (business daily) + freq : str or DateOffset, default 'B' (business daily) Frequency strings can have multiples, e.g. '5H'. - tz : string or None + tz : str or None Time zone name for returning localized DatetimeIndex, for example Asia/Beijing. normalize : bool, default False Normalize start/end dates to midnight before generating date range. - name : string, default None + name : str, default None Name of the resulting DatetimeIndex. - weekmask : string or None, default None + weekmask : str or None, default None Weekmask of valid business days, passed to ``numpy.busdaycalendar``, only used when custom frequency strings are passed. The default value None is equivalent to 'Mon Tue Wed Thu Fri'. @@ -1627,7 +1627,7 @@ def bdate_range( .. versionadded:: 0.21.0 - closed : string, default None + closed : str, default None Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None). **kwargs diff --git a/pandas/core/resample.py b/pandas/core/resample.py index a5d0e2cb3b58f..545bc21dd6d1b 100644 --- a/pandas/core/resample.py +++ b/pandas/core/resample.py @@ -423,7 +423,7 @@ def pad(self, limit=None): Parameters ---------- - limit : integer, optional + limit : int, optional limit of how many values to fill Returns @@ -514,7 +514,7 @@ def backfill(self, limit=None): Parameters ---------- - limit : integer, optional + limit : int, optional Limit of how many values to fill. Returns @@ -628,7 +628,7 @@ def fillna(self, method, limit=None): * 'backfill' or 'bfill': use next valid observation to fill gap. * 'nearest': use nearest valid observation to fill gap. - limit : integer, optional + limit : int, optional Limit of how many consecutive missing values to fill. Returns @@ -823,7 +823,7 @@ def std(self, ddof=1, *args, **kwargs): Parameters ---------- - ddof : integer, default 1 + ddof : int, default 1 Degrees of freedom. Returns @@ -840,7 +840,7 @@ def var(self, ddof=1, *args, **kwargs): Parameters ---------- - ddof : integer, default 1 + ddof : int, default 1 degrees of freedom Returns diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index b07647cf5b5fb..32dc3c1f3e8f2 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -577,7 +577,7 @@ def to_datetime( Parameters ---------- - arg : integer, float, string, datetime, list, tuple, 1-d array, Series + arg : int, float, str, datetime, list, tuple, 1-d array, Series or DataFrame/dict-like errors : {'ignore', 'raise', 'coerce'}, default 'raise' @@ -585,13 +585,13 @@ def to_datetime( - If 'raise', then invalid parsing will raise an exception - If 'coerce', then invalid parsing will be set as NaT - If 'ignore', then invalid parsing will return the input - dayfirst : boolean, default False + dayfirst : bool, default False Specify a date parse order if `arg` is str or its list-likes. If True, parses dates with the day first, eg 10/11/12 is parsed as 2012-11-10. Warning: dayfirst=True is not strict, but will prefer to parse with day first (this is a known bug, based on dateutil behavior). - yearfirst : boolean, default False + yearfirst : bool, default False Specify a date parse order if `arg` is str or its list-likes. - If True parses dates with the year first, eg 10/11/12 is parsed as @@ -604,10 +604,10 @@ def to_datetime( .. versionadded:: 0.16.1 - utc : boolean, default None + utc : bool, default None Return UTC DatetimeIndex if True (converting any tz-aware datetime.datetime objects as well). - box : boolean, default True + box : bool, default True - If True returns a DatetimeIndex or Index-like object - If False returns ndarray of values. @@ -617,22 +617,22 @@ def to_datetime( instead to get an ndarray of values or numpy.datetime64, respectively. - format : string, default None + format : str, default None strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse all the way up to nanoseconds. See strftime documentation for more information on choices: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior - exact : boolean, True by default + exact : bool, True by default - If True, require an exact format match. - If False, allow the format to match anywhere in the target string. - unit : string, default 'ns' + unit : str, default 'ns' unit of the arg (D,s,ms,us,ns) denote the unit, which is an integer or float number. This will be based off the origin. Example, with unit='ms' and origin='unix' (the default), this would calculate the number of milliseconds to the unix epoch start. - infer_datetime_format : boolean, default False + infer_datetime_format : bool, default False If True and no `format` is given, attempt to infer the format of the datetime strings, and if it can be inferred, switch to a faster method of parsing them. In some cases this can increase the parsing @@ -649,7 +649,7 @@ def to_datetime( origin. .. versionadded:: 0.20.0 - cache : boolean, default True + cache : bool, default True If True, use a cache of unique, converted dates to apply the datetime conversion. May produce significant speed-up when parsing duplicate date strings, especially ones with timezone offsets. diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index 571c544d48b29..6bd3532d538c7 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -29,12 +29,12 @@ def read_sas( By file-like object, we refer to objects with a ``read()`` method, such as a file handler (e.g. via builtin ``open`` function) or ``StringIO``. - format : string {'xport', 'sas7bdat'} or None + format : str {'xport', 'sas7bdat'} or None If None, file format is inferred from file extension. If 'xport' or 'sas7bdat', uses the corresponding format. index : identifier of index column, defaults to None Identifier of column that should be used as index of the DataFrame. - encoding : string, default is None + encoding : str, default is None Encoding for text data. If None, text data are stored as raw bytes. chunksize : int Read file `chunksize` lines at a time, returns iterator. diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index fe6b339c2f4c8..8724382d9ec55 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -28,7 +28,7 @@ def hist_series( yrot=None, figsize=None, bins=10, - **kwds + **kwargs ): """ Draw histogram of the input series using matplotlib. @@ -56,7 +56,7 @@ def hist_series( bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified. - `**kwds` : keywords + **kwargs To be passed to the actual plotting function Returns @@ -80,7 +80,7 @@ def hist_series( yrot=yrot, figsize=figsize, bins=bins, - **kwds + **kwargs ) @@ -99,7 +99,7 @@ def hist_frame( figsize=None, layout=None, bins=10, - **kwds + **kwargs ): """ Make a histogram of the DataFrame's. @@ -151,7 +151,7 @@ def hist_frame( bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified. - **kwds + **kwargs All other plotting keyword arguments to be passed to :meth:`matplotlib.pyplot.hist`. @@ -194,7 +194,7 @@ def hist_frame( figsize=figsize, layout=layout, bins=bins, - **kwds + **kwargs ) @@ -209,7 +209,7 @@ def boxplot( figsize=None, layout=None, return_type=None, - **kwds + **kwargs ): """ Make a box plot from DataFrame columns. @@ -260,7 +260,7 @@ def boxplot( If ``return_type`` is `None`, a NumPy array of axes with the same shape as ``layout`` is returned. - **kwds + **kwargs All other plotting keyword arguments to be passed to :func:`matplotlib.pyplot.boxplot`. @@ -385,7 +385,7 @@ def boxplot( figsize=figsize, layout=layout, return_type=return_type, - **kwds + **kwargs ) @@ -401,7 +401,7 @@ def boxplot_frame( figsize=None, layout=None, return_type=None, - **kwds + **kwargs ): plot_backend = _get_plot_backend() return plot_backend.boxplot_frame( @@ -415,7 +415,7 @@ def boxplot_frame( figsize=figsize, layout=layout, return_type=return_type, - **kwds + **kwargs ) @@ -431,7 +431,7 @@ def boxplot_frame_groupby( layout=None, sharex=False, sharey=True, - **kwds + **kwargs ): """ Make box plots from DataFrameGroupBy data. @@ -459,7 +459,7 @@ def boxplot_frame_groupby( Whether y-axes will be shared among subplots .. versionadded:: 0.23.1 - `**kwds` : Keyword Arguments + **kwargs All other plotting keyword arguments to be passed to matplotlib's boxplot function @@ -495,7 +495,7 @@ def boxplot_frame_groupby( layout=layout, sharex=sharex, sharey=sharey, - **kwds + **kwargs ) @@ -586,7 +586,7 @@ class PlotAccessor(PandasObject): labels with "(right)" in the legend include_bool : bool, default is False If True, boolean values can be plotted. - `**kwds` : keywords + **kwargs Options to pass to matplotlib plotting method. Returns @@ -810,7 +810,7 @@ def line(self, x=None, y=None, **kwargs): The values to be plotted. Either the location or the label of the columns to be used. By default, it will use the remaining DataFrame numeric columns. - **kwds + **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. Returns @@ -880,7 +880,7 @@ def bar(self, x=None, y=None, **kwargs): y : label or position, optional Allows plotting of one column versus another. If not specified, all numerical columns are used. - **kwds + **kwargs Additional keyword arguments are documented in :meth:`DataFrame.plot`. @@ -963,7 +963,7 @@ def barh(self, x=None, y=None, **kwargs): Column to be used for categories. y : label or position, default All numeric columns in dataframe Columns to be plotted from the DataFrame. - **kwds + **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. Returns @@ -1049,7 +1049,7 @@ def box(self, by=None, **kwargs): ---------- by : str or sequence Column in the DataFrame to group by. - **kwds : optional + **kwargs Additional keywords are documented in :meth:`DataFrame.plot`. @@ -1092,7 +1092,7 @@ def hist(self, by=None, bins=10, **kwargs): Column in the DataFrame to group by. bins : int, default 10 Number of histogram bins to be used. - **kwds + **kwargs Additional keyword arguments are documented in :meth:`DataFrame.plot`. @@ -1148,7 +1148,7 @@ def kde(self, bw_method=None, ind=None, **kwargs): 1000 equally spaced points are used. If `ind` is a NumPy array, the KDE is evaluated at the points passed. If `ind` is an integer, `ind` number of equally spaced points are used. - **kwds : optional + **kwargs Additional keyword arguments are documented in :meth:`pandas.%(this-datatype)s.plot`. @@ -1250,7 +1250,7 @@ def area(self, x=None, y=None, **kwargs): stacked : bool, default True Area plots are stacked by default. Set to False to create a unstacked plot. - **kwds : optional + **kwargs Additional keyword arguments are documented in :meth:`DataFrame.plot`. @@ -1322,7 +1322,7 @@ def pie(self, **kwargs): y : int or label, optional Label or position of the column to plot. If not provided, ``subplots=True`` argument must be passed. - **kwds + **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. Returns @@ -1404,7 +1404,7 @@ def scatter(self, x, y, s=None, c=None, **kwargs): - A column name or position whose values will be used to color the marker points according to a colormap. - **kwds + **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. Returns @@ -1476,7 +1476,7 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None, **kwargs): Alternatively, gridsize can be a tuple with two elements specifying the number of hexagons in the x-direction and the y-direction. - **kwds + **kwargs Additional keyword arguments are documented in :meth:`DataFrame.plot`.