def widen_cat_column(old_ds, new_type):
name = old_ds.name
tmp_name = "__tmp_" + old_ds.name
grp = old_ds.parent
ds = grp.create_dataset(tmp_name,
data = old_ds[:],
shape = old_ds.shape,
maxshape = (None,),
dtype = new_type,
compression = COMPRESSION,
shuffle = True,
chunks = (CHUNK_SIZE,))
del grp[name]
grp.move(tmp_name, name)
return ds
评论列表
文章目录