Skip to content

Commit 44cf44f

Browse files
authored
Merge branch 'main' into fix_348
2 parents e7a7071 + 42eb06e commit 44cf44f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/nested_pandas/nestedframe/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1876,7 +1876,8 @@ def reduce(self, func, *args, infer_nesting=True, append_columns=False, **kwargs
18761876
nested_col = pack_lists(rename_df, name=layer)
18771877
results_nf = results_nf[
18781878
[col for col in results_nf.columns if not col.startswith(f"{layer}.")]
1879-
].join(nested_col)
1879+
]
1880+
results_nf[layer] = nested_col
18801881

18811882
if append_columns:
18821883
# Append the results to the original NestedFrame

tests/nested_pandas/nestedframe/test_nestedframe.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,3 +2209,12 @@ def test_issue348():
22092209
name="new",
22102210
)
22112211
assert isinstance(new, NestedFrame)
2212+
2213+
2214+
def test_issue350():
2215+
"""https://github.com/lincc-frameworks/nested-pandas/issues/350"""
2216+
nf = generate_data(3, 2)
2217+
nf = nf.set_index(np.array([100, 100, 101]))
2218+
result = nf.reduce(lambda flux: {"new.flux": flux}, "nested.flux")
2219+
assert len(result) == 3
2220+

0 commit comments

Comments
 (0)