diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index 2d4ded9e2e6ba..bce6c352ce480 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -71,7 +71,7 @@ def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False): accessors : string list of accessors to add typ : 'property' or 'method' overwrite : boolean, default False - overwrite the method/property in the target class if it exists. + Overwrite the method/property in the target class if it exists. """ def _create_delegator_property(name): @@ -118,12 +118,12 @@ def delegate_names(delegate, accessors, typ, overwrite=False): Parameters ---------- delegate : object - the class to get methods/properties & doc-strings + The class to get methods/properties & doc-strings. accessors : Sequence[str] - List of accessor to add + List of accessor to add. typ : {'property', 'method'} overwrite : boolean, default False - overwrite the method/property in the target class if it exists + Overwrite the method/property in the target class if it exists. Returns ------- @@ -157,11 +157,11 @@ class CachedAccessor: Parameters ---------- name : str - The namespace this will be accessed under, e.g. ``df.foo`` + The namespace this will be accessed under, e.g. ``df.foo``. accessor : cls The class with the extension methods. The class' __init__ method should expect one of a ``Series``, ``DataFrame`` or ``Index`` as - the single argument ``data`` + the single argument ``data``. """ def __init__(self, name, accessor): diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 43e52cb011324..ced0bd3f3474f 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -910,24 +910,26 @@ def rename_categories(self, new_categories, inplace=False): ---------- new_categories : list-like, dict-like or callable - * list-like: all items must be unique and the number of items in - the new categories must match the existing number of categories. + New categories which will replace old categories. - * dict-like: specifies a mapping from - old categories to new. Categories not contained in the mapping - are passed through and extra categories in the mapping are - ignored. + * list-like: all items must be unique and the number of items in + the new categories must match the existing number of categories. - .. versionadded:: 0.21.0 + * dict-like: specifies a mapping from + old categories to new. Categories not contained in the mapping + are passed through and extra categories in the mapping are + ignored. - * callable : a callable that is called on all items in the old - categories and whose return values comprise the new categories. + .. versionadded:: 0.21.0. - .. versionadded:: 0.23.0 + * callable : a callable that is called on all items in the old + categories and whose return values comprise the new categories. + + .. versionadded:: 0.23.0. inplace : bool, default False - Whether or not to rename the categories inplace or return a copy of - this categorical with renamed categories. + Whether or not to rename the categories inplace or return a copy of + this categorical with renamed categories. Returns ------- diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index bda5f8f4326f1..e1d428f33d0c6 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -207,7 +207,7 @@ class TimelikeOps: ambiguous times) - 'NaT' will return NaT where there are ambiguous times - 'raise' will raise an AmbiguousTimeError if there are ambiguous - times + times. .. versionadded:: 0.24.0 @@ -223,7 +223,7 @@ class TimelikeOps: - 'NaT' will return NaT where there are nonexistent times - timedelta objects will shift nonexistent times by the timedelta - 'raise' will raise an NonExistentTimeError if there are - nonexistent times + nonexistent times. .. versionadded:: 0.24.0 diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 0335058a69c63..788cd2a3ce5b7 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -993,7 +993,7 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None): ambiguous times) - 'NaT' will return NaT where there are ambiguous times - 'raise' will raise an AmbiguousTimeError if there are ambiguous - times + times. nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \ default 'raise' @@ -1007,11 +1007,12 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None): - 'NaT' will return NaT where there are nonexistent times - timedelta objects will shift nonexistent times by the timedelta - 'raise' will raise an NonExistentTimeError if there are - nonexistent times + nonexistent times. .. versionadded:: 0.24.0 errors : {'raise', 'coerce'}, default None + The method to handle errors: - 'raise' will raise a NonExistentTimeError if a timestamp is not valid in the specified time zone (e.g. due to a transition from @@ -1871,7 +1872,7 @@ def sequence_to_dt64ns( dayfirst : bool, default False yearfirst : bool, default False ambiguous : str, bool, or arraylike, default 'raise' - See pandas._libs.tslibs.conversion.tz_localize_to_utc + See pandas._libs.tslibs.conversion.tz_localize_to_utc. int_as_wall_time : bool, default False Whether to treat ints as wall time in specified timezone, or as nanosecond-precision UNIX epoch (wall time in UTC). @@ -2015,7 +2016,7 @@ def objects_to_datetime64ns( dayfirst : bool yearfirst : bool utc : bool, default False - Whether to convert timezone-aware timestamps to UTC + Whether to convert timezone-aware timestamps to UTC. errors : {'raise', 'ignore', 'coerce'} allow_object : bool Whether to return an object-dtype ndarray instead of raising if the diff --git a/pandas/core/base.py b/pandas/core/base.py index 4d5b20c56df5a..ccc4c0e1eb0c3 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -900,7 +900,7 @@ def to_numpy(self, dtype=None, copy=False): Parameters ---------- dtype : str or numpy.dtype, optional - The dtype to pass to :meth:`numpy.asarray` + The dtype to pass to :meth:`numpy.asarray`. copy : bool, default False Whether to ensure that the returned value is a not a view on another array. Note that ``copy=False`` does not *ensure* that diff --git a/pandas/core/generic.py b/pandas/core/generic.py index ddbdb48ab0441..0c3ead1f011a2 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1675,9 +1675,9 @@ def _check_label_or_level_ambiguity(self, key, axis=0): Parameters ---------- key: str or object - label or level name + Label or level name. axis: int, default 0 - Axis that levels are associated with (0 for index, 1 for columns) + Axis that levels are associated with (0 for index, 1 for columns). Raises ------ @@ -2276,31 +2276,30 @@ def to_json( orient : str Indication of expected JSON string format. - * Series + * Series: + + - default is 'index' + - allowed values are: {'split','records','index','table'}. - - default is 'index' - - allowed values are: {'split','records','index','table'} + * DataFrame: - * DataFrame + - default is 'columns' + - allowed values are: {'split', 'records', 'index', 'columns', + 'values', 'table'}. - - default is 'columns' - - allowed values are: - {'split','records','index','columns','values','table'} + * The format of the JSON string: - * The format of the JSON string + - 'split' : dict like {'index' -> [index], 'columns' -> [columns], + 'data' -> [values]} + - 'records' : list like [{column -> value}, ... , {column -> value}] + - 'index' : dict like {index -> {column -> value}} + - 'columns' : dict like {column -> {index -> value}} + - 'values' : just the values array + - 'table' : dict like {'schema': {schema}, 'data': {data}} - - 'split' : dict like {'index' -> [index], - 'columns' -> [columns], 'data' -> [values]} - - 'records' : list like - [{column -> value}, ... , {column -> value}] - - 'index' : dict like {index -> {column -> value}} - - 'columns' : dict like {column -> {index -> value}} - - 'values' : just the values array - - 'table' : dict like {'schema': {schema}, 'data': {data}} - describing the data, and the data component is - like ``orient='records'``. + Describing the data, where data component is like ``orient='records'``. - .. versionchanged:: 0.20.0 + .. versionchanged:: 0.20.0 date_format : {None, 'epoch', 'iso'} Type of date conversion. 'epoch' = epoch milliseconds, @@ -2562,7 +2561,7 @@ def to_msgpack(self, path_or_buf=None, encoding="utf-8", **kwargs): ---------- path : str, buffer-like, or None Destination for the serialized object. - If None, return generated bytes + If None, return generated bytes. append : bool, default False Whether to append to an existing msgpack. compress : str, default None @@ -2753,8 +2752,8 @@ def to_pickle(self, path, compression="infer", protocol=pickle.HIGHEST_PROTOCOL) values are 0, 1, 2, 3, 4. A negative value for the protocol parameter is equivalent to setting its value to HIGHEST_PROTOCOL. - .. [1] https://docs.python.org/3/library/pickle.html - .. versionadded:: 0.21.0 + .. [1] https://docs.python.org/3/library/pickle.html. + .. versionadded:: 0.21.0. See Also -------- @@ -3852,7 +3851,7 @@ def reindex_like(self, other, method=None, copy=True, limit=None, tolerance=None * pad / ffill: propagate last valid observation forward to next valid * backfill / bfill: use next valid observation to fill gap - * nearest: use nearest valid observations to fill gap + * nearest: use nearest valid observations to fill gap. copy : bool, default True Return a new object, even if the passed indexes are the same. @@ -4326,7 +4325,7 @@ def reindex(self, *args, **kwargs): %(optional_labels)s %(axes)s : array-like, optional New labels / index to conform to, should be specified using - keywords. Preferably an Index object to avoid duplicating data + keywords. Preferably an Index object to avoid duplicating data. %(optional_axis)s method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'} Method to use for filling holes in reindexed DataFrame. @@ -4334,10 +4333,10 @@ def reindex(self, *args, **kwargs): monotonically increasing/decreasing index. * None (default): don't fill gaps - * pad / ffill: propagate last valid observation forward to next - valid - * backfill / bfill: use next valid observation to fill gap - * nearest: use nearest valid observations to fill gap + * pad / ffill: Propagate last valid observation forward to next + valid. + * backfill / bfill: Use next valid observation to fill gap. + * nearest: Use nearest valid observations to fill gap. copy : bool, default True Return a new object, even if the passed indexes are the same. @@ -7929,11 +7928,11 @@ def asfreq(self, freq, method=None, how=None, normalize=False, fill_value=None): * 'pad' / 'ffill': propagate last valid observation forward to next valid - * 'backfill' / 'bfill': use NEXT valid observation to fill + * 'backfill' / 'bfill': use NEXT valid observation to fill. how : {'start', 'end'}, default end - For PeriodIndex only, see PeriodIndex.asfreq + For PeriodIndex only (see PeriodIndex.asfreq). normalize : bool, default False - Whether to reset output index to midnight + Whether to reset output index to midnight. fill_value : scalar, optional Value to use for missing values, applied during upsampling (note this does not fill NaNs that already were present). @@ -8605,14 +8604,14 @@ def rank( axis : {0 or 'index', 1 or 'columns'}, default 0 Index to direct ranking. method : {'average', 'min', 'max', 'first', 'dense'}, default 'average' - How to rank the group of records that have the same value - (i.e. ties): + How to rank the group of records that have the same value (i.e. ties): * average: average rank of the group * min: lowest rank in the group * max: highest rank in the group * first: ranks assigned in order they appear in the array - * dense: like 'min', but rank always increases by 1 between groups + * dense: like 'min', but rank always increases by 1 between groups. + numeric_only : bool, optional For DataFrame objects, rank only numeric columns if set to True. na_option : {'keep', 'top', 'bottom'}, default 'keep' @@ -8620,7 +8619,8 @@ def rank( * keep: assign NaN rank to NaN values * top: assign smallest rank to NaN values if ascending - * bottom: assign highest rank to NaN values if ascending + * bottom: assign highest rank to NaN values if ascending. + ascending : bool, default True Whether or not the elements should be ranked in ascending order. pct : bool, default False @@ -8719,20 +8719,22 @@ def ranker(data): other : DataFrame or Series join : {'outer', 'inner', 'left', 'right'}, default 'outer' axis : allowed axis of the other object, default None - Align on index (0), columns (1), or both (None) + Align on index (0), columns (1), or both (None). level : int or level name, default None Broadcast across a level, matching Index values on the - passed MultiIndex level + passed MultiIndex level. copy : bool, default True Always returns new objects. If copy=False and no reindexing is required then original objects are returned. fill_value : scalar, default np.NaN Value to use for missing values. Defaults to NaN, but can be any - "compatible" value + "compatible" value. method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None - Method to use for filling holes in reindexed Series - pad / ffill: propagate last valid observation forward to next valid - backfill / bfill: use NEXT valid observation to fill gap + Method to use for filling holes in reindexed Series: + + - pad / ffill: propagate last valid observation forward to next valid. + - backfill / bfill: use NEXT valid observation to fill gap. + limit : int, default None If method is specified, this is the maximum number of consecutive NaN values to forward/backward fill. In other words, if there is @@ -8741,10 +8743,10 @@ def ranker(data): maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None. fill_axis : %(axes_single_arg)s, default 0 - Filling axis, method and limit + Filling axis, method and limit. broadcast_axis : %(axes_single_arg)s, default None Broadcast values along this axis, if aligning two objects of - different dimensions + different dimensions. Returns ------- @@ -9401,7 +9403,7 @@ def slice_shift(self, periods=1, axis=0): Parameters ---------- periods : int - Number of periods to move, can be positive or negative + Number of periods to move, can be positive or negative. Returns ------- @@ -9435,12 +9437,12 @@ def tshift(self, periods=1, freq=None, axis=0): Parameters ---------- periods : int - Number of periods to move, can be positive or negative + Number of periods to move, can be positive or negative. freq : DateOffset, timedelta, or str, default None Increment to use from the tseries module - or time rule expressed as a string (e.g. 'EOM') + or time rule expressed as a string (e.g. 'EOM'). axis : {0 or ‘index’, 1 or ‘columns’, None}, default 0 - Corresponds to the axis that contains the Index + Corresponds to the axis that contains the Index. Returns ------- @@ -9711,9 +9713,9 @@ def tz_localize( axis : the axis to localize level : int, str, default None If axis ia a MultiIndex, localize a specific level. Otherwise - must be None + must be None. copy : bool, default True - Also make a copy of the underlying data + Also make a copy of the underlying data. ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise' When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from @@ -9729,7 +9731,7 @@ def tz_localize( ambiguous times) - 'NaT' will return NaT where there are ambiguous times - 'raise' will raise an AmbiguousTimeError if there are ambiguous - times + times. nonexistent : str, default 'raise' A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST. Valid values are: @@ -9741,7 +9743,7 @@ def tz_localize( - 'NaT' will return NaT where there are nonexistent times - timedelta objects will shift nonexistent times by the timedelta - 'raise' will raise an NonExistentTimeError if there are - nonexistent times + nonexistent times. .. versionadded:: 0.24.0 @@ -10911,10 +10913,10 @@ def _doc_parms(cls): axis : %(axis_descr)s skipna : bool, default True Exclude NA/null values. If an entire row/column is NA, the result - will be NA + will be NA. level : int or level name, default None If the axis is a MultiIndex (hierarchical), count along a - particular level, collapsing into a %(name1)s + particular level, collapsing into a %(name1)s. ddof : int, default 1 Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements. diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 0b20df38e7d42..4f17aa0c69521 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -149,13 +149,13 @@ class DatetimeIndex(DatetimeIndexOpsMixin, Int64Index, DatetimeDelegateMixin): non-DST time (note that this flag is only applicable for ambiguous times) - 'NaT' will return NaT where there are ambiguous times - - 'raise' will raise an AmbiguousTimeError if there are ambiguous times + - 'raise' will raise an AmbiguousTimeError if there are ambiguous times. name : object - Name to be stored in the index + Name to be stored in the index. dayfirst : bool, default False - If True, parse dates in `data` with the day first order + If True, parse dates in `data` with the day first order. yearfirst : bool, default False - If True parse dates in `data` with the year first order + If True parse dates in `data` with the year first order. Attributes ---------- diff --git a/pandas/core/indexes/timedeltas.py b/pandas/core/indexes/timedeltas.py index 49dcea4da5760..c0a07082a2e8d 100644 --- a/pandas/core/indexes/timedeltas.py +++ b/pandas/core/indexes/timedeltas.py @@ -615,7 +615,7 @@ def insert(self, loc, item): ---------- loc : int item : object - if not either a Python datetime or a numpy integer-like, returned + If not either a Python datetime or a numpy integer-like, returned Index dtype will be object rather than datetime. Returns @@ -718,18 +718,18 @@ def timedelta_range( Parameters ---------- start : str or timedelta-like, default None - Left bound for generating timedeltas + Left bound for generating timedeltas. end : str or timedelta-like, default None - Right bound for generating timedeltas + Right bound for generating timedeltas. periods : int, default None - Number of periods to generate + Number of periods to generate. freq : str or DateOffset, default 'D' - Frequency strings can have multiples, e.g. '5H' + Frequency strings can have multiples, e.g. '5H'. name : str, default None - Name of the resulting TimedeltaIndex + Name of the resulting TimedeltaIndex. closed : str, default None Make the interval closed with respect to the given frequency to - the 'left', 'right', or both sides (None) + the 'left', 'right', or both sides (None). Returns ------- diff --git a/pandas/core/series.py b/pandas/core/series.py index 97e8a2dbac7f5..c6389877f237d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -325,11 +325,11 @@ def _init_dict(self, data, index=None, dtype=None): Parameters ---------- data : dict or dict-like - Data used to populate the new Series + Data used to populate the new Series. index : Index or index-like, default None - index for the new Series: if None, use dict keys + Index for the new Series: if None, use dict keys. dtype : dtype, default None - dtype for the new Series: if None, infer from data + The dtype for the new Series: if None, infer from data. Returns ------- @@ -1324,9 +1324,9 @@ def _set_value(self, label, value, takeable: bool = False): Parameters ---------- label : object - Partial indexing with MultiIndex not allowed + Partial indexing with MultiIndex not allowed. value : object - Scalar value + Scalar value. takeable : interpret the index as indexers, default False Returns @@ -1781,7 +1781,7 @@ def _set_name(self, name, inplace=False): ---------- name : str inplace : bool - whether to modify `self` directly or return a copy + Whether to modify `self` directly or return a copy. """ inplace = validate_bool_kwarg(inplace, "inplace") ser = self if inplace else self.copy() @@ -1924,9 +1924,12 @@ def drop_duplicates(self, keep="first", inplace=False): Parameters ---------- keep : {'first', 'last', ``False``}, default 'first' + Method to handle dropping duplicates: + - 'first' : Drop duplicates except for the first occurrence. - 'last' : Drop duplicates except for the last occurrence. - ``False`` : Drop all duplicates. + inplace : bool, default ``False`` If ``True``, performs operation inplace and returns None. @@ -2002,6 +2005,8 @@ def duplicated(self, keep="first"): Parameters ---------- keep : {'first', 'last', False}, default 'first' + Method to handle dropping duplicates: + - 'first' : Mark duplicates as ``True`` except for the first occurrence. - 'last' : Mark duplicates as ``True`` except for the last @@ -2244,10 +2249,9 @@ def round(self, decimals=0, *args, **kwargs): Parameters ---------- - decimals : int - Number of decimal places to round to (default: 0). - If decimals is negative, it specifies the number of - positions to the left of the decimal point. + decimals : int, default 0 + Number of decimal places to round to. If decimals is negative, + it specifies the number of positions to the left of the decimal point. Returns ------- @@ -2281,7 +2285,7 @@ def quantile(self, q=0.5, interpolation="linear"): Parameters ---------- q : float or array-like, default 0.5 (50% quantile) - 0 <= q <= 1, the quantile(s) to compute. + The quantile(s) to compute, which can lie in range: 0 <= q <= 1. interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points `i` and `j`: @@ -2343,15 +2347,17 @@ def corr(self, other, method="pearson", min_periods=None): other : Series Series with which to compute the correlation. method : {'pearson', 'kendall', 'spearman'} or callable - * pearson : standard correlation coefficient - * kendall : Kendall Tau correlation coefficient - * spearman : Spearman rank correlation - * callable: callable with input two 1d ndarrays - and returning a float. Note that the returned matrix from corr - will have 1 along the diagonals and will be symmetric - regardless of the callable's behavior - .. versionadded:: 0.24.0 + Method used to compute correlation: + - pearson : Standard correlation coefficient + - kendall : Kendall Tau correlation coefficient + - spearman : Spearman rank correlation + - callable: Callable with input two 1d ndarrays and returning a float. + + .. versionadded:: 0.24.0 + Note that the returned matrix from corr will have 1 along the + diagonals and will be symmetric regardless of the callable's + behavior. min_periods : int, optional Minimum number of observations needed to have a valid result. @@ -2712,10 +2718,10 @@ def _binop(self, other, func, level=None, fill_value=None): func : binary operator fill_value : float or object Value to substitute for NA/null values. If both Series are NA in a - location, the result will be NA regardless of the passed fill value + location, the result will be NA regardless of the passed fill value. level : int or level name, default None Broadcast across a level, matching Index values on the - passed MultiIndex level + passed MultiIndex level. Returns ------- @@ -3295,7 +3301,7 @@ def argsort(self, axis=0, kind="quicksort", order=None): Has no effect but is accepted for compatibility with numpy. kind : {'mergesort', 'quicksort', 'heapsort'}, default 'quicksort' Choice of sorting algorithm. See np.sort for more - information. 'mergesort' is the only stable algorithm + information. 'mergesort' is the only stable algorithm. order : None Has no effect but is accepted for compatibility with numpy. @@ -3549,7 +3555,7 @@ def reorder_levels(self, order): Parameters ---------- order : list of int representing new level order - (reference level by number or key) + Reference level by number or key. Returns ------- @@ -3750,9 +3756,9 @@ def _gotitem(self, key, ndim, subset=None): ---------- key : string / list of selections ndim : 1,2 - requested ndim of result + Requested ndim of result. subset : object, default None - subset to act on + Subset to act on. """ return self @@ -4076,7 +4082,7 @@ def rename(self, index=None, **kwargs): Parameters ---------- index : scalar, hashable sequence, dict-like or function, optional - dict-like or functions are transformations to apply to + Functions or dict-like are transformations to apply to the index. Scalar or hashable sequence-like will alter the ``Series.name`` attribute. diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 888d2ae6f9473..2f2e7234999f2 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -57,12 +57,12 @@ def cat_core(list_of_columns: List, sep: str): List of arrays to be concatenated with sep; these arrays may not contain NaNs! sep : string - The separator string for concatenating the columns + The separator string for concatenating the columns. Returns ------- nd.array - The concatenation of list_of_columns with sep + The concatenation of list_of_columns with sep. """ if sep == "": # no need to interleave sep if it is empty @@ -85,12 +85,12 @@ def cat_safe(list_of_columns: List, sep: str): List of arrays to be concatenated with sep; these arrays may not contain NaNs! sep : string - The separator string for concatenating the columns + The separator string for concatenating the columns. Returns ------- nd.array - The concatenation of list_of_columns with sep + The concatenation of list_of_columns with sep. """ try: result = cat_core(list_of_columns, sep) @@ -506,13 +506,18 @@ def str_replace(arr, pat, repl, n=-1, case=None, flags=0, regex=True): n : int, default -1 (all) Number of replacements to make from start. case : bool, default None + Determines if replace is case sensitive: + - If True, case sensitive (the default if `pat` is a string) - Set to False for case insensitive - - Cannot be set if `pat` is a compiled regex + - Cannot be set if `pat` is a compiled regex. + flags : int, default 0 (no flags) - - re module flags, e.g. re.IGNORECASE - - Cannot be set if `pat` is a compiled regex + Regex module flags, e.g. re.IGNORECASE. Cannot be set if `pat` is a compiled + regex. regex : bool, default True + Determines if assumes the passed-in pattern is a regular expression: + - If True, assumes the passed-in pattern is a regular expression. - If False, treats the pattern as a literal string - Cannot be set to False if `pat` is a compiled regex or `repl` is @@ -713,7 +718,7 @@ def str_match(arr, pat, case=True, flags=0, na=np.nan): case : bool, default True If True, case sensitive. flags : int, default 0 (no flags) - re module flags, e.g. re.IGNORECASE. + Regex module flags, e.g. re.IGNORECASE. na : default NaN Fill value for missing values. @@ -1681,7 +1686,7 @@ def str_translate(arr, table): Parameters ---------- table : dict - table is a mapping of Unicode ordinals to Unicode ordinals, strings, or + Table is a mapping of Unicode ordinals to Unicode ordinals, strings, or None. Unmapped characters are left untouched. Characters mapped to None are deleted. :meth:`str.maketrans` is a helper function for making translation tables. @@ -2134,11 +2139,12 @@ def _get_series_list(self, others): Parameters ---------- others : Series, DataFrame, np.ndarray, list-like or list-like of - objects that are either Series, Index or np.ndarray (1-dim) + Objects that are either Series, Index or np.ndarray (1-dim). Returns ------- - list : others transformed into list of Series + list of Series + Others transformed into list of Series. """ from pandas import Series, DataFrame @@ -2556,7 +2562,7 @@ def rsplit(self, pat=None, n=-1, expand=False): String to split on. pat : str, default whitespace .. deprecated:: 0.24.0 - Use ``sep`` instead + Use ``sep`` instead. expand : bool, default True If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index. @@ -2712,13 +2718,13 @@ def pad(self, width, side="left", fillchar=" "): ---------- width : int Minimum width of resulting string; additional characters will be filled - with ``fillchar`` + with ``fillchar``. fillchar : str - Additional character for filling, default is whitespace + Additional character for filling, default is whitespace. Returns ------- - filled : Series/Index of objects + filled : Series/Index of objects. """ @Appender(_shared_docs["str_pad"] % dict(side="left and right", method="center")) @@ -2754,7 +2760,7 @@ def zfill(self, width): Returns ------- - Series/Index of objects + Series/Index of objects. See Also -------- @@ -2842,7 +2848,7 @@ def encode(self, encoding, errors="strict"): Returns ------- - Series/Index of objects + Series or Index of object See Also -------- @@ -2967,15 +2973,15 @@ def extractall(self, pat, flags=0): Parameters ---------- sub : str - Substring being searched + Substring being searched. start : int - Left edge index + Left edge index. end : int - Right edge index + Right edge index. Returns ------- - found : Series/Index of integer values + Series or Index of int. See Also -------- @@ -3018,7 +3024,7 @@ def normalize(self, form): Parameters ---------- form : {'NFC', 'NFKC', 'NFD', 'NFKD'} - Unicode form + Unicode form. Returns ------- @@ -3041,15 +3047,15 @@ def normalize(self, form): Parameters ---------- sub : str - Substring being searched + Substring being searched. start : int - Left edge index + Left edge index. end : int - Right edge index + Right edge index. Returns ------- - found : Series/Index of objects + Series or Index of object See Also -------- @@ -3147,7 +3153,7 @@ def rindex(self, sub, start=0, end=None): Returns ------- - Series/Index of objects + Series or Index of object See Also -------- diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 966a18e11a620..a32214ba36cb6 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -36,28 +36,28 @@ def hist_series( Parameters ---------- by : object, optional - If passed, then used to form histograms for separate groups + If passed, then used to form histograms for separate groups. ax : matplotlib axis object - If not passed, uses gca() + If not passed, uses gca(). grid : bool, default True - Whether to show axis grid lines + Whether to show axis grid lines. xlabelsize : int, default None - If specified changes the x-axis label size + If specified changes the x-axis label size. xrot : float, default None - rotation of x axis labels + Rotation of x axis labels. ylabelsize : int, default None - If specified changes the y-axis label size + If specified changes the y-axis label size. yrot : float, default None - rotation of y axis labels + Rotation of y axis labels. figsize : tuple, default None - figure size in inches by default + Figure size in inches by default. bins : int or sequence, default 10 Number of histogram bins to be used. If an integer is given, bins + 1 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. **kwargs - To be passed to the actual plotting function + To be passed to the actual plotting function. Returns ------- @@ -441,27 +441,28 @@ def boxplot_frame_groupby( grouped : Grouped DataFrame subplots : bool * ``False`` - no subplots will be used - * ``True`` - create a subplot for each group + * ``True`` - create a subplot for each group. + column : column name or list of names, or vector - Can be any valid input to groupby + Can be any valid input to groupby. fontsize : int or str rot : label rotation angle grid : Setting this to True will show the grid ax : Matplotlib axis object, default None figsize : A tuple (width, height) in inches layout : tuple (optional) - (rows, columns) for the layout of the plot + The layout of the plot: (rows, columns). sharex : bool, default False - Whether x-axes will be shared among subplots + Whether x-axes will be shared among subplots. .. versionadded:: 0.23.1 sharey : bool, default True - Whether y-axes will be shared among subplots + Whether y-axes will be shared among subplots. .. versionadded:: 0.23.1 **kwargs All other plotting keyword arguments to be passed to - matplotlib's boxplot function + matplotlib's boxplot function. Returns ------- @@ -507,7 +508,7 @@ class PlotAccessor(PandasObject): Parameters ---------- data : Series or DataFrame - The object for which the method is called + The object for which the method is called. x : label or position, default None Only used if data is a DataFrame. y : label, position or list of label, positions, default None @@ -526,30 +527,31 @@ class PlotAccessor(PandasObject): - 'area' : area plot - 'pie' : pie plot - 'scatter' : scatter plot - - 'hexbin' : hexbin plot + - 'hexbin' : hexbin plot. + figsize : a tuple (width, height) in inches use_index : bool, default True - Use index as ticks for x axis + Use index as ticks for x axis. title : str or list Title to use for the plot. If a string is passed, print the string at the top of the figure. If a list is passed and `subplots` is True, print each item in the list above the corresponding subplot. grid : bool, default None (matlab style default) - Axis grid lines - legend : False/True/'reverse' - Place legend on axis subplots + Axis grid lines. + legend : bool or {'reverse'} + Place legend on axis subplots. style : list or dict - The matplotlib line style per column + The matplotlib line style per column. logx : bool or 'sym', default False - Use log scaling or symlog scaling on x axis + Use log scaling or symlog scaling on x axis. .. versionchanged:: 0.25.0 logy : bool or 'sym' default False - Use log scaling or symlog scaling on y axis + Use log scaling or symlog scaling on y axis. .. versionchanged:: 0.25.0 loglog : bool or 'sym', default False - Use log scaling or symlog scaling on both x and y axes + Use log scaling or symlog scaling on both x and y axes. .. versionchanged:: 0.25.0 xticks : sequence @@ -560,7 +562,7 @@ class PlotAccessor(PandasObject): ylim : 2-tuple/list rot : int, default None Rotation for ticks (xticks for vertical, yticks for horizontal - plots) + plots). fontsize : int, default None Font size for xticks and yticks. colormap : str or matplotlib colormap object, default None @@ -568,11 +570,11 @@ class PlotAccessor(PandasObject): name from matplotlib. colorbar : bool, optional If True, plot colorbar (only relevant for 'scatter' and 'hexbin' - plots) + plots). position : float Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 - (center) + (center). table : bool, Series or DataFrame, default False If True, draw a table using the data in the DataFrame and the data will be transposed to meet matplotlib's default layout. @@ -585,7 +587,7 @@ class PlotAccessor(PandasObject): Equivalent to yerr. mark_right : bool, default True When using a secondary_y axis, automatically mark the column - labels with "(right)" in the legend + labels with "(right)" in the legend. include_bool : bool, default is False If True, boolean values can be plotted. **kwargs diff --git a/pandas/tseries/offsets.py b/pandas/tseries/offsets.py index 81d8869dd7ba0..5ca4d25ede0fc 100644 --- a/pandas/tseries/offsets.py +++ b/pandas/tseries/offsets.py @@ -229,7 +229,7 @@ def __add__(date): - minute - second - microsecond - - nanosecond + - nanosecond. See Also -------- @@ -1684,7 +1684,7 @@ class WeekOfMonth(_WeekOfMonthMixin, DateOffset): - 3 is Thursday - 4 is Friday - 5 is Saturday - - 6 is Sunday + - 6 is Sunday. """ _prefix = "WOM" @@ -1760,7 +1760,7 @@ class LastWeekOfMonth(_WeekOfMonthMixin, DateOffset): - 3 is Thursday - 4 is Friday - 5 is Saturday - - 6 is Sunday + - 6 is Sunday. """ _prefix = "LWOM" @@ -2080,7 +2080,7 @@ class FY5253(DateOffset): - 3 is Thursday - 4 is Friday - 5 is Saturday - - 6 is Sunday + - 6 is Sunday. startingMonth : int {1, 2, ... 12}, default 1 The month in which the fiscal year ends. @@ -2298,7 +2298,7 @@ class FY5253Quarter(DateOffset): - 3 is Thursday - 4 is Friday - 5 is Saturday - - 6 is Sunday + - 6 is Sunday. startingMonth : int {1, 2, ..., 12}, default 1 The month in which fiscal years end.