Skip to content

Delete exception from pandas frame #60069

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,10 @@ def __init__(
original_dtype = dtype

# GH47215
if isinstance(index, set):
raise ValueError("index cannot be a set")
if isinstance(columns, set):
raise ValueError("columns cannot be a set")
# if isinstance(index, set):
# raise ValueError("index cannot be a set")
# if isinstance(columns, set):
# raise ValueError("columns cannot be a set")

if copy is None:
if isinstance(data, dict):
Expand Down
12 changes: 6 additions & 6 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3111,13 +3111,13 @@ def test_construction_from_ndarray_with_eadtype_mismatched_columns(self):
with pytest.raises(ValueError, match=msg):
DataFrame(arr2, columns=["foo", "bar"])

def test_columns_indexes_raise_on_sets(self):
# def test_columns_indexes_raise_on_sets(self):
# GH 47215
data = [[1, 2, 3], [4, 5, 6]]
with pytest.raises(ValueError, match="index cannot be a set"):
DataFrame(data, index={"a", "b"})
with pytest.raises(ValueError, match="columns cannot be a set"):
DataFrame(data, columns={"a", "b", "c"})
# data = [[1, 2, 3], [4, 5, 6]]
# with pytest.raises(ValueError, match="index cannot be a set"):
# DataFrame(data, index={"a", "b"})
# with pytest.raises(ValueError, match="columns cannot be a set"):
# DataFrame(data, columns={"a", "b", "c"})

# TODO: make this not cast to object in pandas 3.0
@pytest.mark.skipif(
Expand Down
Loading