gpt4 book ai didi

python - NumPy 的 loadtxt() 和 genfromtxt 的 'dtype' 有哪些可用数据类型?

转载 作者:IT老高 更新时间:2023-10-28 21:33:32 25 4
gpt4 key购买 nike

有哪些可用的numpy.loadtxtnumpy.genfromtxt用于导入具有不同数据类型的表数据,可用的缩写有哪些(例如 i32 表示整数)?

This post演示了条件的使用,我很好奇是否有人可以详细说明。

最佳答案

除了np.sctypeDict,还有这些变量:

In [141]: np.typecodes
Out[141]:
{'All': '?bhilqpBHILQPefdgFDGSUVOMm',
'AllFloat': 'efdgFDG',
'AllInteger': 'bBhHiIlLqQpP',
'Character': 'c',
'Complex': 'FDG',
'Datetime': 'Mm',
'Float': 'efdg',
'Integer': 'bhilqp',
'UnsignedInteger': 'BHILQP'}

In [143]: np.sctypes
Out[143]:
{'complex': [numpy.complex64, numpy.complex128, numpy.complex192],
'float': [numpy.float16, numpy.float32, numpy.float64, numpy.float96],
'int': [numpy.int8, numpy.int16, numpy.int32, numpy.int32, numpy.int64],
'others': [bool, object, str, unicode, numpy.void],
'uint': [numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint32, numpy.uint64]}

关于python - NumPy 的 loadtxt() 和 genfromtxt 的 'dtype' 有哪些可用数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13997087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com