Skip to content

PERF: Improve performance in read_csv with numeric index col #44610

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

Merged
merged 3 commits into from
Nov 25, 2021

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 24, 2021

The isin was calling the np.in1d and was checking against a bunch of strings causing the performance issues

@phofl phofl added IO CSV read_csv, to_csv Performance Memory or execution speed performance labels Nov 24, 2021
@jreback jreback added this to the 1.4 milestone Nov 25, 2021
@jreback
Copy link
Contributor

jreback commented Nov 25, 2021

the benchmark runner failed, not really sure why

@phofl
Copy link
Member Author

phofl commented Nov 25, 2021

I think I have used the wrong base class, changed it

@phofl
Copy link
Member Author

phofl commented Nov 25, 2021

greenish now

@@ -518,6 +518,7 @@ Performance improvements
- Performance improvement in :meth:`Series.to_frame` (:issue:`43558`)
- Performance improvement in :meth:`Series.mad` (:issue:`43010`)
- Performance improvement in :func:`merge` (:issue:`43332`)
- Performance improvement in :func:`read_csv` when ``index_col`` was set with a numeric column (:issue:`44158`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is a regression compared to 1.3.x. would be ok backporting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equally slow on 1.2.5 and 1.3.4, so don't think we should backport

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok

@jreback jreback modified the milestones: 1.4, 1.3.5 Nov 25, 2021
@jreback jreback merged commit 7f43278 into pandas-dev:master Nov 25, 2021
@jreback
Copy link
Contributor

jreback commented Nov 25, 2021

thanks @phofl very nice
keep em coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO CSV read_csv, to_csv Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: Why does specifying the index column in pandas significantly increases the read time of a csv?
2 participants