File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ including other versions of pandas.
1414
1515Fixed regressions
1616~~~~~~~~~~~~~~~~~
17- -
17+ - Fixed performance regression in :func: ` read_csv ` ( :issue: ` 44106 `)
1818-
1919
2020.. ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -206,9 +206,10 @@ def _set_noconvert_columns(self):
206206 """
207207 assert self .orig_names is not None
208208 # error: Cannot determine type of 'names'
209- col_indices = [
210- self .orig_names .index (x ) for x in self .names # type: ignore[has-type]
211- ]
209+
210+ # much faster than using orig_names.index(x) xref GH#44106
211+ names_dict = {x : i for i , x in enumerate (self .orig_names )}
212+ col_indices = [names_dict [x ] for x in self .names ] # type: ignore[has-type]
212213 # error: Cannot determine type of 'names'
213214 noconvert_columns = self ._set_noconvert_dtype_columns (
214215 col_indices ,
You can’t perform that action at this time.
0 commit comments