Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: from_frame #29

Open
venaturum opened this issue Nov 2, 2021 · 0 comments
Open

ENH: from_frame #29

venaturum opened this issue Nov 2, 2021 · 0 comments
Labels
good first issue Good for newcomers

Comments

@venaturum
Copy link
Collaborator

venaturum commented Nov 2, 2021

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
@venaturum venaturum added the good first issue Good for newcomers label Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant