-
Couldn't load subscription status.
- Fork 1
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Feature request
I was trying to help someone with a problem like this yesterday:
import nested_pandas as npd
ndf = npd.NestedFrame({"a":[1,2,3], "b":[[1,2,3],[4,5,6],[7,8,9]], "c":[[10,20,30],[40,50,60],[70,80,90]]})
# How do I pack b and c into a nested structure?
from nested_pandas.series.packer import pack_lists
nested = pack_lists(ndf[["b", "c"]], name="nested")
# join back to df as nested col
ndf.join(nested)
While certainly doable using our packing module, I realized this is such a fundamental use case that I was surprised we don't have a top level function for it. I propose we add a top-level function, like nest_lists that would accomplish this as follows:
ndf.nest_lists(columns=["b","c"], name="nested", drop=True) #drop signals we remove b and c from base columns
Before submitting
Please check the following:
- I have described the purpose of the suggested change, specifying what I need the enhancement to accomplish, i.e. what problem it solves.
- I have included any relevant links, screenshots, environment information, and data relevant to implementing the requested feature, as well as pseudocode for how I want to access the new functionality.
- If I have ideas for how the new feature could be implemented, I have provided explanations and/or pseudocode and/or task lists for the steps.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request