Skip to content

Commit

Permalink
Set smallest dtypes on DataSet
Browse files Browse the repository at this point in the history
  • Loading branch information
percyfal committed Dec 13, 2024
1 parent 4137a75 commit a398a91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bio2zarr/bed2zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ def bed2zarr(
data, contig_id, name_id = encode_categoricals(data, bed_type)
fields = update_field_bounds(data, bed_type)
dtypes = {f.name: f.smallest_dtype() for f in fields}
data = data.astype(dtypes)
data.index.name = "records"
ds = xr.Dataset.from_dataframe(data)
for k, v in dtypes.items():
ds[k] = ds[k].astype(v)
if records_chunk_size is None:
records_chunk_size = len(data)
chunks = {
Expand Down

0 comments on commit a398a91

Please sign in to comment.