File tree Expand file tree Collapse file tree 1 file changed +20
-16
lines changed Expand file tree Collapse file tree 1 file changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -251,22 +251,26 @@ def load(
251
251
csv_path = f'{ os .path .dirname (_mapper .root )} /{ cat .catalog_file } '
252
252
cat .catalog_file = csv_path
253
253
converters = read_csv_kwargs .pop ('converters' , {}) # Hack
254
- pl_df = pl .read_csv (
255
- cat .catalog_file ,
256
- storage_options = storage_options ,
257
- ** read_csv_kwargs ,
258
- ).with_columns (
259
- [
260
- pl .col (colname )
261
- .str .replace ('^.' , '[' ) # Replace first/last chars with [ or ].
262
- .str .replace ('.$' , ']' ) # set/tuple => list
263
- .str .replace_all (
264
- "'" ,
265
- '"' ,
266
- )
267
- .str .json_decode () # This is to do with the way polars reads json - single versus double quotes
268
- for colname in converters .keys ()
269
- ]
254
+ pl_df = (
255
+ pl .scan_csv ( # See https://github.com/pola-rs/polars/issues/13040 - can't use read_csv.
256
+ cat .catalog_file ,
257
+ storage_options = storage_options ,
258
+ ** read_csv_kwargs ,
259
+ )
260
+ .with_columns (
261
+ [
262
+ pl .col (colname )
263
+ .str .replace ('^.' , '[' ) # Replace first/last chars with [ or ].
264
+ .str .replace ('.$' , ']' ) # set/tuple => list
265
+ .str .replace_all (
266
+ "'" ,
267
+ '"' ,
268
+ )
269
+ .str .json_decode () # This is to do with the way polars reads json - single versus double quotes
270
+ for colname in converters .keys ()
271
+ ]
272
+ )
273
+ .collect ()
270
274
)
271
275
else :
272
276
pl_df = pl .DataFrame (cat .catalog_dict )
You can’t perform that action at this time.
0 commit comments