numpy.lib.format.drop_metadata#

lib.format.drop_metadata(dtype,/)[source]#

Returns the dtype unchanged if it contained no metadata or a copy of thedtype if it (or any of its structure dtypes) contained metadata.

This utility is used bynp.save andnp.savez to drop metadata beforesaving.

Note

Due to its limitation this function may move to a more appropriatehome or change in the future and is considered semi-public API only.

Warning

This function does not preserve more strange things like record dtypesand user dtypes may simply return the wrong thing. If you need to besure about the latter, check the result with:np.can_cast(new_dtype,dtype,casting="no").