From 1c46f99a6e2183fe1ea26f6cf158caf6b51712c1 Mon Sep 17 00:00:00 2001 From: Joaq Date: Tue, 29 Oct 2019 00:55:36 +0800 Subject: [PATCH 1/6] Fix SS06 errors SS06 errors fixed for the following: pandas.DataFrame.slice_shift pandas.DataFrame.to_period pandas.DataFrame.plot pandas.DataFrame.sparse.density pandas.DataFrame.style pandas.Series.as_blocks pandas.Series.ix pandas.Series.ptp pandas.DataFrame.as_blocks pandas.DataFrame.ix --- pandas/core/arrays/sparse/accessor.py | 6 ++++-- pandas/core/frame.py | 8 ++++++-- pandas/core/generic.py | 23 ++++++++++++++--------- pandas/core/indexing.py | 3 +-- pandas/plotting/_core.py | 2 ++ 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/pandas/core/arrays/sparse/accessor.py b/pandas/core/arrays/sparse/accessor.py index 57fd6d284af31..91391508489b9 100644 --- a/pandas/core/arrays/sparse/accessor.py +++ b/pandas/core/arrays/sparse/accessor.py @@ -308,8 +308,10 @@ def to_coo(self): @property def density(self) -> float: """ - Ratio of non-sparse points to total (dense) data points - represented in the DataFrame. + Ratio of non-sparse points to total (dense) data points. + + Ratio of non-sparse points to total (dense) data points represented + in the DataFrame. """ return np.mean([column.array.density for _, column in self._parent.items()]) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 23611055d6f01..c8af28e127618 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -814,8 +814,10 @@ def to_string( @property def style(self): """ - Property returning a Styler object containing methods for - building a styled HTML representation fo the DataFrame. + Returns a Styler object. + + Property returning a Styler object containing methods for building + a styled HTML representation fo the DataFrame. See Also -------- @@ -8207,6 +8209,8 @@ def to_timestamp(self, freq=None, how="start", axis=0, copy=True): def to_period(self, freq=None, axis=0, copy=True): """ + Convert DataFrame from DatetimeIndex to PeriodIndex. + Convert DataFrame from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). diff --git a/pandas/core/generic.py b/pandas/core/generic.py index fe0923f096493..f77610e042915 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5766,11 +5766,13 @@ def ftypes(self): def as_blocks(self, copy=True): """ - Convert the frame to a dict of dtype -> Constructor Types that each has - a homogeneous dtype. + Convert the frame to a dict of dtype. .. deprecated:: 0.21.0 + Convert the frame to a dict of dtype-> Constructor Types that each + has a homogeneous dtype. + NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in as_matrix) @@ -9428,9 +9430,10 @@ def shift(self, periods=1, freq=None, axis=0, fill_value=None): def slice_shift(self, periods=1, axis=0): """ - Equivalent to `shift` without copying data. The shifted data will - not include the dropped periods and the shifted axis will be smaller - than the original. + Equivalent to `shift` without copying data. + + The shifted data will not include the dropped periods and the + shifted axis will be smaller than the original. Parameters ---------- @@ -10739,10 +10742,12 @@ def nanptp(values, axis=0, skipna=True): name, name2, axis_descr, - """Return the difference between the maximum value and the - minimum value in the object. This is the equivalent of the - ``numpy.ndarray`` method ``ptp``.\n\n.. deprecated:: 0.24.0 - Use numpy.ptp instead""", + """Return the difference between the max and min value in the object.\n + .. deprecated:: 0.24.0\n + Return the difference between the maximum value and the minimum value in\n + the object. This is the equivalent of the ``numpy.ndarray`` method \n + ``ptp``.\n + Use numpy.ptp instead""", nanptp, ) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 45cb037600fd7..44c786f003369 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1291,8 +1291,7 @@ def _get_slice_axis(self, slice_obj: slice, axis: int): class _IXIndexer(_NDFrameIndexer): """ - A primarily label-location based indexer, with integer position - fallback. + A primarily label-location based indexer, with integer position fallback. Warning: Starting in 0.20.0, the .ix indexer is deprecated, in favor of the more strict .iloc and .loc indexers. diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 127fdffafcf36..7aeb9dc35305b 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -496,6 +496,8 @@ def boxplot_frame_groupby( class PlotAccessor(PandasObject): """ + Make plots of Series or DataFrame. + Make plots of Series or DataFrame using the backend specified by the option ``plotting.backend``. By default, matplotlib is used. From 5f51037eca20a83af52b3eb69c76ac6902917c33 Mon Sep 17 00:00:00 2001 From: Joaq Date: Tue, 29 Oct 2019 01:49:57 +0800 Subject: [PATCH 2/6] Fix deprecation preceding extended summary error --- pandas/core/generic.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index f77610e042915..d862f3d64c121 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -10742,12 +10742,11 @@ def nanptp(values, axis=0, skipna=True): name, name2, axis_descr, - """Return the difference between the max and min value in the object.\n - .. deprecated:: 0.24.0\n - Return the difference between the maximum value and the minimum value in\n - the object. This is the equivalent of the ``numpy.ndarray`` method \n - ``ptp``.\n - Use numpy.ptp instead""", + """Return the difference between the min and max value. + \n.. deprecated:: 0.24.0 Use numpy.ptp instead + \nReturn the difference between the maximum value and the + minimum value in the object. This is the equivalent of the + ``numpy.ndarray`` method ``ptp``.""", nanptp, ) From 45b68668d59c97b9c0782020a96ac1014af33441 Mon Sep 17 00:00:00 2001 From: Joaq Almirante Date: Tue, 29 Oct 2019 08:37:23 +0800 Subject: [PATCH 3/6] Fix typo in pandas/core/frame.py Co-Authored-By: William Ayd --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index c8af28e127618..d7043a8cda7b2 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -816,7 +816,7 @@ def style(self): """ Returns a Styler object. - Property returning a Styler object containing methods for building + Contains methods for building a styled HTML representation of the DataFrame. a styled HTML representation fo the DataFrame. See Also From 226d7af26e61273919eabac6584198925bb13792 Mon Sep 17 00:00:00 2001 From: Joaq Almirante Date: Tue, 29 Oct 2019 08:40:14 +0800 Subject: [PATCH 4/6] Update pandas/core/generic.py Co-Authored-By: William Ayd --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index d862f3d64c121..97e1061e5a33d 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5766,7 +5766,7 @@ def ftypes(self): def as_blocks(self, copy=True): """ - Convert the frame to a dict of dtype. + Convert the frame to a dict of dtype -> Constructor Types. .. deprecated:: 0.21.0 From cf3369ef9844f180a172bb03dbcea3c321a85771 Mon Sep 17 00:00:00 2001 From: Joaq Almirante Date: Tue, 29 Oct 2019 08:42:16 +0800 Subject: [PATCH 5/6] Update pandas/plotting/_core.py Co-Authored-By: William Ayd --- pandas/plotting/_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 7aeb9dc35305b..c11d94c381d6d 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -498,7 +498,7 @@ class PlotAccessor(PandasObject): """ Make plots of Series or DataFrame. - Make plots of Series or DataFrame using the backend specified by the + Uses the backend specified by the option ``plotting.backend``. By default, matplotlib is used. Parameters From 7c628ab93627f52417410466f331fca617766487 Mon Sep 17 00:00:00 2001 From: Joaq Date: Tue, 29 Oct 2019 08:42:41 +0800 Subject: [PATCH 6/6] Remove extended summaries --- pandas/core/arrays/sparse/accessor.py | 3 --- pandas/core/generic.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/pandas/core/arrays/sparse/accessor.py b/pandas/core/arrays/sparse/accessor.py index 91391508489b9..595af6dc08733 100644 --- a/pandas/core/arrays/sparse/accessor.py +++ b/pandas/core/arrays/sparse/accessor.py @@ -309,9 +309,6 @@ def to_coo(self): def density(self) -> float: """ Ratio of non-sparse points to total (dense) data points. - - Ratio of non-sparse points to total (dense) data points represented - in the DataFrame. """ return np.mean([column.array.density for _, column in self._parent.items()]) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 97e1061e5a33d..81742b5337e47 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5770,9 +5770,6 @@ def as_blocks(self, copy=True): .. deprecated:: 0.21.0 - Convert the frame to a dict of dtype-> Constructor Types that each - has a homogeneous dtype. - NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in as_matrix)