Skip to content
Merged
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
17 changes: 17 additions & 0 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,23 @@ def test_from_dict_columns_parameter(self):
dict([("A", [1, 2]), ("B", [4, 5])]), columns=["one", "two"]
)

@pytest.mark.parametrize(
"data_dict, keys",
[
([{("a",): 1}, {("a",): 2}], [("a",)]),
([OrderedDict([(("a",), 1), (("b",), 2)])], [("a",), ("b",)]),
([{("a", "b"): 1}], [("a", "b")]),
],
)
def test_constructor_from_dict_tuples(self, data_dict, keys):
# GH 16769
df = DataFrame.from_dict(data_dict)

result = df.columns
expected = Index(keys, dtype="object", tupleize_cols=False)

tm.assert_index_equal(result, expected)

def test_constructor_Series_named(self):
a = Series([1, 2, 3], index=["a", "b", "c"], name="x")
df = DataFrame(a)
Expand Down