Skip to content

Commit da8fa12

Browse files
authored
perf: improve membership check performance in column filtering
1 parent 4f27380 commit da8fa12

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/io/parsers/c_parser_wrapper.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,10 @@ def read(
258258
)
259259

260260
columns = _filter_usecols(self.usecols, columns)
261+
columns_set = set(columns)
261262

262-
col_dict = {k: v for k, v in col_dict.items() if k in columns}
263+
264+
col_dict = {k: v for k, v in col_dict.items() if k in columns_set}
263265

264266
return index, columns, col_dict
265267

0 commit comments

Comments
 (0)