From 74e1e115e6e52363eeb56e874a117dabdc3bc1b8 Mon Sep 17 00:00:00 2001 From: phofl Date: Fri, 1 Oct 2021 16:29:30 +0200 Subject: [PATCH 1/2] TYP: Fix typing of frame.explode --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 613a4cc829514..e84621297851c 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8201,7 +8201,7 @@ def stack(self, level: Level = -1, dropna: bool = True): def explode( self, - column: Scalar | tuple | list[Scalar | tuple], + column: IndexLabel | tuple, ignore_index: bool = False, ) -> DataFrame: """ @@ -8211,7 +8211,7 @@ def explode( Parameters ---------- - column : Scalar or tuple or list thereof + column : IndexLabel or tuple thereof Column(s) to explode. For multiple columns, specify a non-empty list with each element be str or tuple, and all specified columns their list-like data @@ -8293,7 +8293,7 @@ def explode( if not self.columns.is_unique: raise ValueError("columns must be unique") - columns: list[Scalar | tuple] + columns: list[Hashable | tuple] if is_scalar(column) or isinstance(column, tuple): columns = [column] elif isinstance(column, list) and all( From 2e666d2a6cfb21c7ea4eb1f0eef01e5479407954 Mon Sep 17 00:00:00 2001 From: phofl Date: Fri, 1 Oct 2021 17:19:43 +0200 Subject: [PATCH 2/2] TYP: Fix typing of frame.explode --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index e84621297851c..5f4207d0985ef 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -8201,7 +8201,7 @@ def stack(self, level: Level = -1, dropna: bool = True): def explode( self, - column: IndexLabel | tuple, + column: IndexLabel, ignore_index: bool = False, ) -> DataFrame: """ @@ -8211,7 +8211,7 @@ def explode( Parameters ---------- - column : IndexLabel or tuple thereof + column : IndexLabel Column(s) to explode. For multiple columns, specify a non-empty list with each element be str or tuple, and all specified columns their list-like data @@ -8293,7 +8293,7 @@ def explode( if not self.columns.is_unique: raise ValueError("columns must be unique") - columns: list[Hashable | tuple] + columns: list[Hashable] if is_scalar(column) or isinstance(column, tuple): columns = [column] elif isinstance(column, list) and all(