Skip to content

Commit 207ed90

Browse files
Down to 4 failign tests now
1 parent 1d953db commit 207ed90

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

intake_esm/cat.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,22 +251,26 @@ def load(
251251
csv_path = f'{os.path.dirname(_mapper.root)}/{cat.catalog_file}'
252252
cat.catalog_file = csv_path
253253
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()
270274
)
271275
else:
272276
pl_df = pl.DataFrame(cat.catalog_dict)

0 commit comments

Comments
 (0)