Skip to content

How to delete an existing dataset? #982

Answered by 1uc
aghaeifar asked this question in Questions
Discussion options

You must be logged in to vote

You can "delete" a dataset with:

grp.unlink(dset_name)

and create a new dataset. The issue is that unlinking will not automatically shrink the size of the file. I think it'll (sometimes) mark the space as unused and then reuse it if possible. You can use h5repack to copy the file, but eliminating all gaps in the original file.

Note that the special case of a growing dataset is typically solved differently. One creates a DataSet that's unlimited in the direction in which it'll grow. Then one can later resize the dataset in the unlimited direction and overwrite data as needed.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aghaeifar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants