Skip to content

Commit 93f3b24

Browse files
authored
Update explode to handle lists (#523)
* Update explode to handle lists Based on this feedback here that we received: microsoft/pylance-release#3871 It looks like explode also takes a list. * Add test * Update to match formatter * Review feedback * Review feedback * Fix formatting
1 parent 68f4d5f commit 93f3b24

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,9 @@ class DataFrame(NDFrame, OpsMixin):
10111011
def stack(
10121012
self, level: Level | list[Level] = ..., dropna: _bool = ...
10131013
) -> DataFrame | Series[Any]: ...
1014-
def explode(self, column: _str | tuple, ignore_index: _bool = ...) -> DataFrame: ...
1014+
def explode(
1015+
self, column: Sequence[Hashable], ignore_index: _bool = ...
1016+
) -> DataFrame: ...
10151017
def unstack(
10161018
self,
10171019
level: Level = ...,

tests/test_frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ def test_types_explode() -> None:
13371337
res1: pd.DataFrame = df.explode("A")
13381338
res2: pd.DataFrame = df.explode("A", ignore_index=False)
13391339
res3: pd.DataFrame = df.explode("A", ignore_index=True)
1340+
res4: pd.DataFrame = df.explode(["A", "B"])
13401341

13411342

13421343
def test_types_rename() -> None:

0 commit comments

Comments
 (0)