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: Method to recover IntervalIndex when reloaing plain-text files #23595

Open
benkrikler opened this issue Nov 9, 2018 · 3 comments
Open
Labels
Enhancement Interval Interval data type IO CSV read_csv, to_csv

Comments

@benkrikler
Copy link

When an IntervalIndex is written to a plain-text format (csv or with to_string()) the output is well-formatted. If I now reload that CSV file, the IntervalIndex is now recreated as a series / index of strings.

A useful feature would be to convert that string index back into an IntervalIndex. This could potentially be done automatically in the read_csv and read_table methods.

I've implemented such a function into my own code and extracted it to this gist:
https://gist.github.com/benkrikler/cfa0f3703358d5bd7b5abd5fae36db29

I'd need some guidance, but I'd be happy to try turning this into a PR if it were wanted.

@jreback
Copy link
Contributor

jreback commented Nov 9, 2018

see
#23228

and associated PR (which is stale if i want to work on it)

@jreback
Copy link
Contributor

jreback commented Nov 9, 2018

cc @jschendel

@jorisvandenbossche
Copy link
Member

I think the first step is to have a constructor for IntervalIndex from strings? (independent of integration in the csv reading)

@jschendel jschendel added IO CSV read_csv, to_csv Interval Interval data type labels Nov 9, 2018
@jreback jreback added this to the 1.4 milestone Sep 9, 2021
@jreback jreback modified the milestones: 1.4, Contributions Welcome Jan 8, 2022
@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Interval Interval data type IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants