Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed Aug 19, 2024
1 parent 4128a40 commit 0556592
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/nested_pandas/nestedframe/test_nestedframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,14 @@ def test_recover_from_flat():

assert nf2.equals(nf)


def test_from_flat_omitting_columns():
"""test that from_flat successfully produces subsets"""
flat = NestedFrame({"a":[1,1,1,2,2], "b":[2,2,2,4,4], "c":[1,2,3,4,5],
"d":[2,4,6,8,10]}, index=[0,0,0,1,1])

flat = NestedFrame(
{"a": [1, 1, 1, 2, 2], "b": [2, 2, 2, 4, 4], "c": [1, 2, 3, 4, 5], "d": [2, 4, 6, 8, 10]},
index=[0, 0, 0, 1, 1],
)

# omit a base column
nf = NestedFrame.from_flat(flat, base_columns=["b"], nested_columns=["c", "d"])
assert list(nf.columns) == ["b", "nested"]
Expand All @@ -334,6 +337,7 @@ def test_from_flat_omitting_columns():
assert list(nf.columns) == ["a", "b", "nested"]
assert list(nf.nested.nest.fields) == ["c"]


def test_from_lists():
"""Test NestedFrame.from_lists behavior"""
nf = NestedFrame(
Expand Down

0 comments on commit 0556592

Please sign in to comment.