如何进行numpy.sctype2char的向后转换.将char转换为dtypes或sctype



np.sctype2char(sctype(

此函数将dtypes/sctype(如"np.foat"(转换为字符(如"d"(。像这个

>>> np.sctype2char(np.float)
'd'

我的问题是,如何背单词?是否将字符(如"d"(转换为数据类型(如"np.foat"(?像这样的东西(实际上不存在(

>>> np.char2sctype('d')
np.float

我在谷歌上搜索了一下,并在github内部搜索,尽管我没有得到我想要的东西。

问题解决了,感谢w-m

尝试np.dtype构造函数:

>>> np.dtype(np.sctype2char(np.float))
dtype('float64')