File tree 2 files changed +5
-4
lines changed
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.
14
14
15
15
Fixed regressions
16
16
~~~~~~~~~~~~~~~~~
17
- -
17
+ - Fixed performance regression in :func: ` read_csv ` ( :issue: ` 44106 `)
18
18
-
19
19
20
20
.. ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -206,9 +206,10 @@ def _set_noconvert_columns(self):
206
206
"""
207
207
assert self .orig_names is not None
208
208
# 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]
212
213
# error: Cannot determine type of 'names'
213
214
noconvert_columns = self ._set_noconvert_dtype_columns (
214
215
col_indices ,
You can’t perform that action at this time.
0 commit comments