Skip to content

ENH: from_frame #29

@venaturum

Description

@venaturum

Describe the solution you'd like

Add new top-level function into ndframe.py - piso.from_frame

It allows fast creation of interval arrays from vector data in dataframes

Additional context

sig:

def from_frame(frame, start, end, group=None, index=False)

  • frame is pandas.DataFrame
  • start, end, group all strings
  • index is boolean and indicate is IntervalIndex, or IntervalArray should be produced.
import piso

df = pd.DataFrame(
    {
        "group";["A", "B", "A", "B"],
        "start":[1,3,5,7],
        "end":[2,4,6,8],
    }
)

piso.from_frame(df, "start", "end", "group")

# produces Series, indexed by "group", where values are interval arrays of type indicated by "index" param

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions