带有NumPy的loadtxt()和genfromtxt的'dtype'可用的数据类型是什么? [英] What are the available datatypes for 'dtype' with NumPy's loadtxt() an genfromtxt?

查看:292
本文介绍了带有NumPy的loadtxt()和genfromtxt的'dtype'可用的数据类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可用的 numpy.loadtxt 是什么,或者 numpy.genfromtxt ,用于导入具有不同数据类型的表格数据,以及可用的缩写形式(例如 i32 表示整数)?

What are the available numpy.loadtxt or numpy.genfromtxt for importing table data with varying datatypes, and what are the available abbreviations for the use (e.g. i32 for integer)?

这篇文章演示了用法的条件,我很好奇是否有人会详细阐述.

This post demonstrates the use of conditions, which I was curious if somebody might elaborate on.

推荐答案

除了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]}

这篇关于带有NumPy的loadtxt()和genfromtxt的'dtype'可用的数据类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆