Skip to content

Commit 290c58a

Browse files
nagesh-chowdaiahnagesh-kumar-abinbevjorisvandenbosschesimonjayhawkins
authored
DOC: Updated resample.py and groupby.py to fix SA04 Errors (#37219)
* DOC: Updated resample.py and groupby.py to fix SA04 Errors * DOC: Fixed flake8 issue * #28792 DOC: Fixed SA04 Errors * #28792 Doc Fix SA04 Errors * Update pandas/core/arrays/integer.py Co-authored-by: Joris Van den Bossche <[email protected]> * Update pandas/core/arrays/boolean.py Co-authored-by: Joris Van den Bossche <[email protected]> * #28792 DOC: udpated reviewers comments * #28792 DOC: Fixing flake8 Errors Co-authored-by: Nagesh Kumar C <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Co-authored-by: Simon Hawkins <[email protected]>
1 parent 10e5ad7 commit 290c58a

File tree

14 files changed

+83
-58
lines changed

14 files changed

+83
-58
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,8 @@ cdef class _Timedelta(timedelta):
10561056

10571057
See Also
10581058
--------
1059-
Timestamp.isoformat
1059+
Timestamp.isoformat : Function is used to convert the given
1060+
Timestamp object into the ISO format.
10601061

10611062
Notes
10621063
-----

pandas/core/arrays/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def _from_factorized(cls, values, original):
232232
233233
See Also
234234
--------
235-
factorize
236-
ExtensionArray.factorize
235+
factorize : Top-level factorize method that dispatches here.
236+
ExtensionArray.factorize : Encode the extension array as an enumerated type.
237237
"""
238238
raise AbstractMethodError(cls)
239239

@@ -501,7 +501,7 @@ def _values_for_argsort(self) -> np.ndarray:
501501
502502
See Also
503503
--------
504-
ExtensionArray.argsort
504+
ExtensionArray.argsort : Return the indices that would sort this array.
505505
"""
506506
# Note: this is used in `ExtensionArray.argsort`.
507507
return np.array(self)
@@ -968,8 +968,8 @@ def take(
968968
969969
See Also
970970
--------
971-
numpy.take
972-
api.extensions.take
971+
numpy.take : Take elements from an array along an axis.
972+
api.extensions.take : Take elements from an array.
973973
974974
Notes
975975
-----

pandas/core/arrays/boolean.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def _values_for_argsort(self) -> np.ndarray:
418418
419419
See Also
420420
--------
421-
ExtensionArray.argsort
421+
ExtensionArray.argsort : Return the indices that would sort this array.
422422
"""
423423
data = self._data.copy()
424424
data[self._mask] = -1

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ def unique(self):
20612061
--------
20622062
pandas.unique
20632063
CategoricalIndex.unique
2064-
Series.unique
2064+
Series.unique : Return unique values of Series object.
20652065
20662066
Examples
20672067
--------

pandas/core/arrays/datetimes.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,10 @@ def isocalendar(self):
12611261
12621262
See Also
12631263
--------
1264-
Timestamp.isocalendar
1265-
datetime.date.isocalendar
1264+
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
1265+
week number, and weekday for the given Timestamp object.
1266+
datetime.date.isocalendar : Return a named tuple object with
1267+
three components: year, week and weekday.
12661268
12671269
Examples
12681270
--------

pandas/core/arrays/integer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def _values_for_argsort(self) -> np.ndarray:
484484
485485
See Also
486486
--------
487-
ExtensionArray.argsort
487+
ExtensionArray.argsort : Return the indices that would sort this array.
488488
"""
489489
data = self._data.copy()
490490
if self._mask.any():

pandas/core/dtypes/base.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ class ExtensionDtype:
2121
2222
See Also
2323
--------
24-
extensions.register_extension_dtype
25-
extensions.ExtensionArray
24+
extensions.register_extension_dtype: Register an ExtensionType
25+
with pandas as class decorator.
26+
extensions.ExtensionArray: Abstract base class for custom 1-D array types.
2627
2728
Notes
2829
-----

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def shape(self) -> Tuple[int, int]:
589589
590590
See Also
591591
--------
592-
ndarray.shape
592+
ndarray.shape : Tuple of array dimensions.
593593
594594
Examples
595595
--------

pandas/core/generic.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def attrs(self) -> Dict[Optional[Hashable], Any]:
260260
261261
See Also
262262
--------
263-
DataFrame.flags
263+
DataFrame.flags : Global flags applying to this object.
264264
"""
265265
if self._attrs is None:
266266
self._attrs = {}
@@ -281,8 +281,8 @@ def flags(self) -> Flags:
281281
282282
See Also
283283
--------
284-
Flags
285-
DataFrame.attrs
284+
Flags : Flags that apply to pandas objects.
285+
DataFrame.attrs : Global metadata applying to this dataset.
286286
287287
Notes
288288
-----

pandas/core/groupby/groupby.py

+25-18
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ class providing the base-class of operations.
7979
_common_see_also = """
8080
See Also
8181
--------
82-
Series.%(name)s
83-
DataFrame.%(name)s
82+
Series.%(name)s : Apply a function %(name)s to a Series.
83+
DataFrame.%(name)s : Apply a function %(name)s
84+
to each row or column of a DataFrame.
8485
"""
8586

8687
_apply_docs = dict(
@@ -318,9 +319,12 @@ class providing the base-class of operations.
318319
319320
See Also
320321
--------
321-
%(klass)s.groupby.apply
322-
%(klass)s.groupby.aggregate
323-
%(klass)s.transform
322+
%(klass)s.groupby.apply : Apply function func group-wise
323+
and combine the results together.
324+
%(klass)s.groupby.aggregate : Aggregate using one or more
325+
operations over the specified axis.
326+
%(klass)s.transform : Transforms the Series on each group
327+
based on the given function.
324328
325329
Notes
326330
-----
@@ -427,9 +431,12 @@ class providing the base-class of operations.
427431
428432
See Also
429433
--------
430-
{klass}.groupby.apply
431-
{klass}.groupby.transform
432-
{klass}.aggregate
434+
{klass}.groupby.apply : Apply function func group-wise
435+
and combine the results together.
436+
{klass}.groupby.transform : Aggregate using one or more
437+
operations over the specified axis.
438+
{klass}.aggregate : Transforms the Series on each group
439+
based on the given function.
433440
434441
Notes
435442
-----
@@ -1871,8 +1878,8 @@ def _fill(self, direction, limit=None):
18711878
18721879
See Also
18731880
--------
1874-
pad
1875-
backfill
1881+
pad : Returns Series with minimum number of char in object.
1882+
backfill : Backward fill the missing values in the dataset.
18761883
"""
18771884
# Need int value for Cython
18781885
if limit is None:
@@ -1906,10 +1913,10 @@ def pad(self, limit=None):
19061913
19071914
See Also
19081915
--------
1909-
Series.pad
1910-
DataFrame.pad
1911-
Series.fillna
1912-
DataFrame.fillna
1916+
Series.pad: Returns Series with minimum number of char in object.
1917+
DataFrame.pad: Object with missing values filled or None if inplace=True.
1918+
Series.fillna: Fill NaN values of a Series.
1919+
DataFrame.fillna: Fill NaN values of a DataFrame.
19131920
"""
19141921
return self._fill("ffill", limit=limit)
19151922

@@ -1932,10 +1939,10 @@ def backfill(self, limit=None):
19321939
19331940
See Also
19341941
--------
1935-
Series.backfill
1936-
DataFrame.backfill
1937-
Series.fillna
1938-
DataFrame.fillna
1942+
Series.backfill : Backward fill the missing values in the dataset.
1943+
DataFrame.backfill: Backward fill the missing values in the dataset.
1944+
Series.fillna: Fill NaN values of a Series.
1945+
DataFrame.fillna: Fill NaN values of a DataFrame.
19391946
"""
19401947
return self._fill("bfill", limit=limit)
19411948

pandas/core/indexes/accessors.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,10 @@ def isocalendar(self):
241241
242242
See Also
243243
--------
244-
Timestamp.isocalendar
245-
datetime.date.isocalendar
244+
Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
245+
week number, and weekday for the given Timestamp object.
246+
datetime.date.isocalendar : Return a named tuple object with
247+
three components: year, week and weekday.
246248
247249
Examples
248250
--------
@@ -331,7 +333,8 @@ def to_pytimedelta(self) -> np.ndarray:
331333
332334
See Also
333335
--------
334-
datetime.timedelta
336+
datetime.timedelta : A duration expressing the difference
337+
between two date, time, or datetime.
335338
336339
Examples
337340
--------

pandas/core/indexes/base.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ def ravel(self, order="C"):
628628
629629
See Also
630630
--------
631-
numpy.ndarray.ravel
631+
numpy.ndarray.ravel : Return a flattened array.
632632
"""
633633
warnings.warn(
634634
"Index.ravel returning ndarray is deprecated; in a future version "
@@ -724,7 +724,8 @@ def astype(self, dtype, copy=True):
724724
725725
See Also
726726
--------
727-
numpy.ndarray.take
727+
numpy.ndarray.take: Return an array formed from the
728+
elements of a at the given indices.
728729
"""
729730

730731
@Appender(_index_shared_docs["take"] % _index_doc_kwargs)
@@ -2324,8 +2325,8 @@ def unique(self, level=None):
23242325
23252326
See Also
23262327
--------
2327-
unique
2328-
Series.unique
2328+
unique : Numpy array of unique values in that column.
2329+
Series.unique : Return unique values of Series object.
23292330
"""
23302331
if level is not None:
23312332
self._validate_index_level(level)
@@ -3968,7 +3969,7 @@ def _values(self) -> Union[ExtensionArray, np.ndarray]:
39683969
39693970
See Also
39703971
--------
3971-
values
3972+
values : Values
39723973
"""
39733974
return self._data
39743975

@@ -4259,7 +4260,8 @@ def putmask(self, mask, value):
42594260
42604261
See Also
42614262
--------
4262-
numpy.ndarray.putmask
4263+
numpy.ndarray.putmask : Changes elements of an array
4264+
based on conditional and input values.
42634265
"""
42644266
values = self.values.copy()
42654267
try:

pandas/core/resample.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __iter__(self):
131131
132132
See Also
133133
--------
134-
GroupBy.__iter__
134+
GroupBy.__iter__ : Generator yielding sequence for each group.
135135
"""
136136
self._set_binner()
137137
return super().__iter__()
@@ -235,9 +235,12 @@ def pipe(self, func, *args, **kwargs):
235235
"""
236236
See Also
237237
--------
238-
DataFrame.groupby.aggregate
239-
DataFrame.resample.transform
240-
DataFrame.aggregate
238+
DataFrame.groupby.aggregate : Aggregate using callable, string, dict,
239+
or list of string/callables.
240+
DataFrame.resample.transform : Transforms the Series on each group
241+
based on the given function.
242+
DataFrame.aggregate: Aggregate using one or more
243+
operations over the specified axis.
241244
"""
242245
)
243246

@@ -454,8 +457,8 @@ def pad(self, limit=None):
454457
455458
See Also
456459
--------
457-
Series.fillna
458-
DataFrame.fillna
460+
Series.fillna: Fill NA/NaN values using the specified method.
461+
DataFrame.fillna: Fill NA/NaN values using the specified method.
459462
"""
460463
return self._upsample("pad", limit=limit)
461464

@@ -829,8 +832,8 @@ def asfreq(self, fill_value=None):
829832
830833
See Also
831834
--------
832-
Series.asfreq
833-
DataFrame.asfreq
835+
Series.asfreq: Convert TimeSeries to specified frequency.
836+
DataFrame.asfreq: Convert TimeSeries to specified frequency.
834837
"""
835838
return self._upsample("asfreq", fill_value=fill_value)
836839

@@ -916,8 +919,13 @@ def quantile(self, q=0.5, **kwargs):
916919
See Also
917920
--------
918921
Series.quantile
922+
Return a series, where the index is q and the values are the quantiles.
919923
DataFrame.quantile
924+
Return a DataFrame, where the columns are the columns of self,
925+
and the values are the quantiles.
920926
DataFrameGroupBy.quantile
927+
Return a DataFrame, where the coulmns are groupby columns,
928+
and the values are its quantiles.
921929
"""
922930
return self._downsample("quantile", q=q, **kwargs)
923931

@@ -1073,7 +1081,7 @@ def _upsample(self, method, limit=None, fill_value=None):
10731081
10741082
See Also
10751083
--------
1076-
.fillna
1084+
.fillna: Fill NA/NaN values using the specified method.
10771085
10781086
"""
10791087
self._set_binner()
@@ -1209,7 +1217,7 @@ def _upsample(self, method, limit=None, fill_value=None):
12091217
12101218
See Also
12111219
--------
1212-
.fillna
1220+
.fillna: Fill NA/NaN values using the specified method.
12131221
12141222
"""
12151223
# we may need to actually resample as if we are timestamps

pandas/io/formats/style.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ def applymap(self, func: Callable, subset=None, **kwargs) -> "Styler":
829829
830830
See Also
831831
--------
832-
Styler.where
832+
Styler.where: Updates the HTML representation with a style which is
833+
selected in accordance with the return value of a function.
833834
"""
834835
self._todo.append(
835836
(lambda instance: getattr(instance, "_applymap"), (func, subset), kwargs)
@@ -870,7 +871,7 @@ def where(
870871
871872
See Also
872873
--------
873-
Styler.applymap
874+
Styler.applymap: Updates the HTML representation with the result.
874875
"""
875876
if other is None:
876877
other = ""
@@ -930,7 +931,7 @@ def export(self) -> List[Tuple[Callable, Tuple, Dict]]:
930931
931932
See Also
932933
--------
933-
Styler.use
934+
Styler.use: Set the styles on the current Styler.
934935
"""
935936
return self._todo
936937

@@ -951,7 +952,7 @@ def use(self, styles: List[Tuple[Callable, Tuple, Dict]]) -> "Styler":
951952
952953
See Also
953954
--------
954-
Styler.export
955+
Styler.export : Export the styles to applied to the current Styler.
955956
"""
956957
self._todo.extend(styles)
957958
return self

0 commit comments

Comments
 (0)