numpy.lib.format.drop_metadata#
- lib.format.drop_metadata(dtype, /)[source]#
Returns the dtype unchanged if it contained no metadata or a copy of the dtype if it (or any of its structure dtypes) contained metadata.
This utility is used by np.save and np.savez to drop metadata before saving.
Note
Due to its limitation this function may move to a more appropriate home or change in the future and is considered semi-public API only.
Warning
This function does not preserve more strange things like record dtypes and user dtypes may simply return the wrong thing. If you need to be sure about the latter, check the result with:
np.can_cast(new_dtype, dtype, casting="no")
.