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 @@ -205,9 +205,10 @@ def _set_noconvert_columns(self):
205
205
"""
206
206
assert self .orig_names is not None
207
207
# error: Cannot determine type of 'names'
208
- col_indices = [
209
- self .orig_names .index (x ) for x in self .names # type: ignore[has-type]
210
- ]
208
+
209
+ # much faster than using orig_names.index(x) xref GH#44106
210
+ names_dict = {x : i for i , x in enumerate (self .orig_names )}
211
+ col_indices = [names_dict [x ] for x in self .names ] # type: ignore[has-type]
211
212
# error: Cannot determine type of 'names'
212
213
noconvert_columns = self ._set_noconvert_dtype_columns (
213
214
col_indices ,
You can’t perform that action at this time.
0 commit comments