8000 Backport PR #44192 on branch 1.3.x (PERF: read_csv GH#44106) by meeseeksmachine · Pull Request #44197 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #44192 on branch 1.3.x (PERF: read_csv GH#44106) #44197

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Backport PR #44192: PERF: read_csv GH#44106
  • Loading branch information
8000 jbrockmendel authored and meeseeksmachine committed Oct 26, 2021
commit 5f4d6683ba5c5ee1b38b9174b91369efc9be601a
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.3.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ including other versions of pandas.

Fixed regressions
~~~~~~~~~~~~~~~~~
-
- Fixed performance regression in :func:`read_csv` (:issue:`44106`)
-

.. ---------------------------------------------------------------------------
Expand Down
89CB
7 changes: 4 additions & 3 deletions pandas/io/parsers/c_parser_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ def _set_noconvert_columns(self):
"""
assert self.orig_names is not None
# error: Cannot determine type of 'names'
col_indices = [
self.orig_names.index(x) for x in self.names # type: ignore[has-type]
]

# much faster than using orig_names.index(x) xref GH#44106
names_dict = {x: i for i, x in enumerate(self.orig_names)}
col_indices = [names_dict[x] for x in self.names] # type: ignore[has-type]
# error: Cannot determine type of 'names'
noconvert_columns = self._set_noconvert_dtype_columns(
col_indices,
Expand Down
0