Skip to content

BUG: df.explode mulitcol with Nan+emptylist #49680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

debnathshoham
Copy link
Member

@debnathshoham debnathshoham commented Nov 13, 2022

@debnathshoham debnathshoham added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Nov 13, 2022
@@ -280,3 +280,24 @@ def test_multi_columns(input_subset, expected_dict, expected_index):
result = df.explode(input_subset)
expected = pd.DataFrame(expected_dict, expected_index)
tm.assert_frame_equal(result, expected)


def test_multi_columns2():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give a better name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"C": [1, 2, np.nan, np.nan, 3, 4],
},
index=[0, 0, 1, 2, 3, 3],
).astype({"A": object, "C": object})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid the astype call?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. used np.array to set dtype of the cols

@phofl phofl added this to the 2.0 milestone Nov 16, 2022
@mroeschke mroeschke merged commit 2455f88 into pandas-dev:main Nov 16, 2022
@mroeschke
Copy link
Member

Thanks @debnathshoham

@debnathshoham debnathshoham deleted the gh46084_dfexplode_bug branch November 17, 2022 05:46
MarcoGorelli pushed a commit to MarcoGorelli/pandas that referenced this pull request Nov 18, 2022
* BUG: df.explode mulitcol with Nan+emptylist

* suggested changes
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
* BUG: df.explode mulitcol with Nan+emptylist

* suggested changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.explode incomplete support on multiple columns with NaN or empty lists
3 participants