Skip to content

Commit

Permalink
DOC: Updated resample.py and groupby.py to fix SA04 Errors (pandas-de…
Browse files Browse the repository at this point in the history
…v#37219)

* DOC: Updated resample.py and groupby.py to fix SA04 Errors

* DOC: Fixed flake8 issue

* pandas-dev#28792 DOC: Fixed SA04 Errors

* pandas-dev#28792 Doc Fix SA04 Errors

* Update pandas/core/arrays/integer.py

Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>

* Update pandas/core/arrays/boolean.py

Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>

* pandas-dev#28792 DOC: udpated reviewers comments

* pandas-dev#28792 DOC: Fixing flake8 Errors

Co-authored-by: Nagesh Kumar C <Nageshkumar.c@ab-inbev.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Simon Hawkins <simonjayhawkins@gmail.com>
  • Loading branch information
4 people authored and ukarroum committed Nov 2, 2020
1 parent 8c1eded commit deb29dd
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 58 deletions.
3 changes: 2 additions & 1 deletion pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,8 @@ cdef class _Timedelta(timedelta):

See Also
--------
Timestamp.isoformat
Timestamp.isoformat : Function is used to convert the given
Timestamp object into the ISO format.

Notes
-----
Expand Down
10 changes: 5 additions & 5 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ def _from_factorized(cls, values, original):
See Also
--------
factorize
ExtensionArray.factorize
factorize : Top-level factorize method that dispatches here.
ExtensionArray.factorize : Encode the extension array as an enumerated type.
"""
raise AbstractMethodError(cls)

Expand Down Expand Up @@ -501,7 +501,7 @@ def _values_for_argsort(self) -> np.ndarray:
See Also
--------
ExtensionArray.argsort
ExtensionArray.argsort : Return the indices that would sort this array.
"""
# Note: this is used in `ExtensionArray.argsort`.
return np.array(self)
Expand Down Expand Up @@ -968,8 +968,8 @@ def take(
See Also
--------
numpy.take
api.extensions.take
numpy.take : Take elements from an array along an axis.
api.extensions.take : Take elements from an array.
Notes
-----
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def _values_for_argsort(self) -> np.ndarray:
See Also
--------
ExtensionArray.argsort
ExtensionArray.argsort : Return the indices that would sort this array.
"""
data = self._data.copy()
data[self._mask] = -1
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@ def unique(self):
--------
pandas.unique
CategoricalIndex.unique
Series.unique
Series.unique : Return unique values of Series object.
Examples
--------
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,10 @@ def isocalendar(self):
See Also
--------
Timestamp.isocalendar
datetime.date.isocalendar
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
week number, and weekday for the given Timestamp object.
datetime.date.isocalendar : Return a named tuple object with
three components: year, week and weekday.
Examples
--------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def _values_for_argsort(self) -> np.ndarray:
See Also
--------
ExtensionArray.argsort
ExtensionArray.argsort : Return the indices that would sort this array.
"""
data = self._data.copy()
if self._mask.any():
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/dtypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class ExtensionDtype:
See Also
--------
extensions.register_extension_dtype
extensions.ExtensionArray
extensions.register_extension_dtype: Register an ExtensionType
with pandas as class decorator.
extensions.ExtensionArray: Abstract base class for custom 1-D array types.
Notes
-----
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def shape(self) -> Tuple[int, int]:
See Also
--------
ndarray.shape
ndarray.shape : Tuple of array dimensions.
Examples
--------
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def attrs(self) -> Dict[Optional[Hashable], Any]:
See Also
--------
DataFrame.flags
DataFrame.flags : Global flags applying to this object.
"""
if self._attrs is None:
self._attrs = {}
Expand All @@ -281,8 +281,8 @@ def flags(self) -> Flags:
See Also
--------
Flags
DataFrame.attrs
Flags : Flags that apply to pandas objects.
DataFrame.attrs : Global metadata applying to this dataset.
Notes
-----
Expand Down
43 changes: 25 additions & 18 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ class providing the base-class of operations.
_common_see_also = """
See Also
--------
Series.%(name)s
DataFrame.%(name)s
Series.%(name)s : Apply a function %(name)s to a Series.
DataFrame.%(name)s : Apply a function %(name)s
to each row or column of a DataFrame.
"""

_apply_docs = dict(
Expand Down Expand Up @@ -318,9 +319,12 @@ class providing the base-class of operations.
See Also
--------
%(klass)s.groupby.apply
%(klass)s.groupby.aggregate
%(klass)s.transform
%(klass)s.groupby.apply : Apply function func group-wise
and combine the results together.
%(klass)s.groupby.aggregate : Aggregate using one or more
operations over the specified axis.
%(klass)s.transform : Transforms the Series on each group
based on the given function.
Notes
-----
Expand Down Expand Up @@ -427,9 +431,12 @@ class providing the base-class of operations.
See Also
--------
{klass}.groupby.apply
{klass}.groupby.transform
{klass}.aggregate
{klass}.groupby.apply : Apply function func group-wise
and combine the results together.
{klass}.groupby.transform : Aggregate using one or more
operations over the specified axis.
{klass}.aggregate : Transforms the Series on each group
based on the given function.
Notes
-----
Expand Down Expand Up @@ -1871,8 +1878,8 @@ def _fill(self, direction, limit=None):
See Also
--------
pad
backfill
pad : Returns Series with minimum number of char in object.
backfill : Backward fill the missing values in the dataset.
"""
# Need int value for Cython
if limit is None:
Expand Down Expand Up @@ -1906,10 +1913,10 @@ def pad(self, limit=None):
See Also
--------
Series.pad
DataFrame.pad
Series.fillna
DataFrame.fillna
Series.pad: Returns Series with minimum number of char in object.
DataFrame.pad: Object with missing values filled or None if inplace=True.
Series.fillna: Fill NaN values of a Series.
DataFrame.fillna: Fill NaN values of a DataFrame.
"""
return self._fill("ffill", limit=limit)

Expand All @@ -1932,10 +1939,10 @@ def backfill(self, limit=None):
See Also
--------
Series.backfill
DataFrame.backfill
Series.fillna
DataFrame.fillna
Series.backfill : Backward fill the missing values in the dataset.
DataFrame.backfill: Backward fill the missing values in the dataset.
Series.fillna: Fill NaN values of a Series.
DataFrame.fillna: Fill NaN values of a DataFrame.
"""
return self._fill("bfill", limit=limit)

Expand Down
9 changes: 6 additions & 3 deletions pandas/core/indexes/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ def isocalendar(self):
See Also
--------
Timestamp.isocalendar
datetime.date.isocalendar
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
week number, and weekday for the given Timestamp object.
datetime.date.isocalendar : Return a named tuple object with
three components: year, week and weekday.
Examples
--------
Expand Down Expand Up @@ -331,7 +333,8 @@ def to_pytimedelta(self) -> np.ndarray:
See Also
--------
datetime.timedelta
datetime.timedelta : A duration expressing the difference
between two date, time, or datetime.
Examples
--------
Expand Down
14 changes: 8 additions & 6 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def ravel(self, order="C"):
See Also
--------
numpy.ndarray.ravel
numpy.ndarray.ravel : Return a flattened array.
"""
warnings.warn(
"Index.ravel returning ndarray is deprecated; in a future version "
Expand Down Expand Up @@ -724,7 +724,8 @@ def astype(self, dtype, copy=True):
See Also
--------
numpy.ndarray.take
numpy.ndarray.take: Return an array formed from the
elements of a at the given indices.
"""

@Appender(_index_shared_docs["take"] % _index_doc_kwargs)
Expand Down Expand Up @@ -2324,8 +2325,8 @@ def unique(self, level=None):
See Also
--------
unique
Series.unique
unique : Numpy array of unique values in that column.
Series.unique : Return unique values of Series object.
"""
if level is not None:
self._validate_index_level(level)
Expand Down Expand Up @@ -3968,7 +3969,7 @@ def _values(self) -> Union[ExtensionArray, np.ndarray]:
See Also
--------
values
values : Values
"""
return self._data

Expand Down Expand Up @@ -4259,7 +4260,8 @@ def putmask(self, mask, value):
See Also
--------
numpy.ndarray.putmask
numpy.ndarray.putmask : Changes elements of an array
based on conditional and input values.
"""
values = self.values.copy()
try:
Expand Down
28 changes: 18 additions & 10 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __iter__(self):
See Also
--------
GroupBy.__iter__
GroupBy.__iter__ : Generator yielding sequence for each group.
"""
self._set_binner()
return super().__iter__()
Expand Down Expand Up @@ -235,9 +235,12 @@ def pipe(self, func, *args, **kwargs):
"""
See Also
--------
DataFrame.groupby.aggregate
DataFrame.resample.transform
DataFrame.aggregate
DataFrame.groupby.aggregate : Aggregate using callable, string, dict,
or list of string/callables.
DataFrame.resample.transform : Transforms the Series on each group
based on the given function.
DataFrame.aggregate: Aggregate using one or more
operations over the specified axis.
"""
)

Expand Down Expand Up @@ -454,8 +457,8 @@ def pad(self, limit=None):
See Also
--------
Series.fillna
DataFrame.fillna
Series.fillna: Fill NA/NaN values using the specified method.
DataFrame.fillna: Fill NA/NaN values using the specified method.
"""
return self._upsample("pad", limit=limit)

Expand Down Expand Up @@ -829,8 +832,8 @@ def asfreq(self, fill_value=None):
See Also
--------
Series.asfreq
DataFrame.asfreq
Series.asfreq: Convert TimeSeries to specified frequency.
DataFrame.asfreq: Convert TimeSeries to specified frequency.
"""
return self._upsample("asfreq", fill_value=fill_value)

Expand Down Expand Up @@ -916,8 +919,13 @@ def quantile(self, q=0.5, **kwargs):
See Also
--------
Series.quantile
Return a series, where the index is q and the values are the quantiles.
DataFrame.quantile
Return a DataFrame, where the columns are the columns of self,
and the values are the quantiles.
DataFrameGroupBy.quantile
Return a DataFrame, where the coulmns are groupby columns,
and the values are its quantiles.
"""
return self._downsample("quantile", q=q, **kwargs)

Expand Down Expand Up @@ -1073,7 +1081,7 @@ def _upsample(self, method, limit=None, fill_value=None):
See Also
--------
.fillna
.fillna: Fill NA/NaN values using the specified method.
"""
self._set_binner()
Expand Down Expand Up @@ -1209,7 +1217,7 @@ def _upsample(self, method, limit=None, fill_value=None):
See Also
--------
.fillna
.fillna: Fill NA/NaN values using the specified method.
"""
# we may need to actually resample as if we are timestamps
Expand Down
9 changes: 5 additions & 4 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@ def applymap(self, func: Callable, subset=None, **kwargs) -> "Styler":
See Also
--------
Styler.where
Styler.where: Updates the HTML representation with a style which is
selected in accordance with the return value of a function.
"""
self._todo.append(
(lambda instance: getattr(instance, "_applymap"), (func, subset), kwargs)
Expand Down Expand Up @@ -870,7 +871,7 @@ def where(
See Also
--------
Styler.applymap
Styler.applymap: Updates the HTML representation with the result.
"""
if other is None:
other = ""
Expand Down Expand Up @@ -930,7 +931,7 @@ def export(self) -> List[Tuple[Callable, Tuple, Dict]]:
See Also
--------
Styler.use
Styler.use: Set the styles on the current Styler.
"""
return self._todo

Expand All @@ -951,7 +952,7 @@ def use(self, styles: List[Tuple[Callable, Tuple, Dict]]) -> "Styler":
See Also
--------
Styler.export
Styler.export : Export the styles to applied to the current Styler.
"""
self._todo.extend(styles)
return self
Expand Down

0 comments on commit deb29dd

Please sign in to comment.