diff --git a/asv_bench/benchmarks/io/parsers.py b/asv_bench/benchmarks/io/parsers.py index 40256e043a0087..c5e099bd44eacb 100644 --- a/asv_bench/benchmarks/io/parsers.py +++ b/asv_bench/benchmarks/io/parsers.py @@ -10,7 +10,7 @@ pass -class DoesStringLookLikeDatetime(object): +class DoesStringLookLikeDatetime: params = (["2Q2005", "0.0", "10000"],) param_names = ["value"] @@ -23,7 +23,7 @@ def time_check_datetimes(self, value): _does_string_look_like_datetime(obj) -class ConcatDateCols(object): +class ConcatDateCols: params = ([1234567890, "AAAA"], [1, 2]) param_names = ["value", "dim"] diff --git a/asv_bench/benchmarks/reshape.py b/asv_bench/benchmarks/reshape.py index 32ca8e6b68d0b2..14505ad49dafa1 100644 --- a/asv_bench/benchmarks/reshape.py +++ b/asv_bench/benchmarks/reshape.py @@ -240,7 +240,7 @@ def time_qcut_datetime(self, bins): pd.qcut(self.datetime_series, bins) -class Explode(object): +class Explode param_names = ["n_rows", "max_list_length"] params = [[100, 1000, 10000], [3, 5, 10]] @@ -250,10 +250,7 @@ def setup(self, n_rows, max_list_length): self.series = pd.Series(data) def time_explode(self, n_rows, max_list_length): - try: - self.series.explode() - except AttributeError: - pass + self.series.explode() from .pandas_vb_common import setup # noqa: F401 diff --git a/asv_bench/benchmarks/series_methods.py b/asv_bench/benchmarks/series_methods.py index e2835c5156f559..6038a2ab4bd9f9 100644 --- a/asv_bench/benchmarks/series_methods.py +++ b/asv_bench/benchmarks/series_methods.py @@ -219,7 +219,7 @@ def time_series_datetimeindex_repr(self): getattr(self.s, "a", None) -class All(object): +class All: params = [[10 ** 3, 10 ** 6], ["fast", "slow"]] param_names = ["N", "case"] @@ -232,7 +232,7 @@ def time_all(self, N, case): self.s.all() -class Any(object): +class Any: params = [[10 ** 3, 10 ** 6], ["fast", "slow"]] param_names = ["N", "case"] @@ -245,7 +245,7 @@ def time_any(self, N, case): self.s.any() -class NanOps(object): +class NanOps: params = [ [ diff --git a/asv_bench/benchmarks/timeseries.py b/asv_bench/benchmarks/timeseries.py index a74527df25f9bd..1020b773f8acbb 100644 --- a/asv_bench/benchmarks/timeseries.py +++ b/asv_bench/benchmarks/timeseries.py @@ -293,7 +293,7 @@ def time_format_YYYYMMDD(self): to_datetime(self.stringsD, format="%Y%m%d") -class ToDatetimeCacheSmallCount(object): +class ToDatetimeCacheSmallCount: params = ([True, False], [50, 500, 5000, 100000]) param_names = ["cache", "count"] diff --git a/ci/code_checks.sh b/ci/code_checks.sh index fec2a882922806..96a8440d856947 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -156,7 +156,7 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Check for python2 new-style classes and for empty parentheses' ; echo $MSG - invgrep -R --include="*.py" --include="*.pyx" -E "class\s\S*\((object)?\):" pandas scripts + invgrep -R --include="*.py" --include="*.pyx" -E "class\s\S*\((object)?\):" pandas asv_bench/benchmarks scripts RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Check for backticks incorrectly rendering because of missing spaces' ; echo $MSG diff --git a/pandas/core/frame.py b/pandas/core/frame.py index a1989fd62b6ee0..886d1584b4963a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -6352,6 +6352,7 @@ def unstack(self, level=-1, fill_value=None): %(other)s pivot_table DataFrame.pivot + Series.explode Examples -------- diff --git a/pandas/core/series.py b/pandas/core/series.py index fa913fcb54c96a..ec8fd9fa680938 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3644,12 +3644,14 @@ def explode(self) -> "Series": Returns ------- - exploded: Series + Series + exploded lists to rows; index will be duplicated for these rows See Also -------- - Series.str.split: Split string values on specified separator. - Series.unstack: Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame. + Series.str.split : Split string values on specified separator. + Series.unstack : Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame. + DataFrame.melt : Unpivot a DataFrame from wide format to long format Notes -----