带下划线的 NumPy 类型:`int_`、`float_` 等 [英] NumPy types with underscore: `int_`, `float_`, etc

查看:92
本文介绍了带下划线的 NumPy 类型:`int_`、`float_` 等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int_float_等中下划线后缀的意义是什么?

What is the significance of the underscore suffixing in int_, float_, etc.?

推荐答案

来自 Numpy 指南的第 21 页 作者:TE Oliphant:

From page 21 of Guide to Numpy by TE Oliphant:

数据类型的名称与标准 Python 对象发生冲突名称后跟一个尾随下划线,''.这些数据类型是如此命名是因为它们使用相同的基础精度为对应的 Python 数据类型.

Names for the data types that would clash with standard Python object names are followed by a trailing underscore, ’ ’. These data types are so named because they use the same underlying precision as the corresponding Python data types.

...

数组类型bool_int_complex_float_object_unicode_str_是增强标量.他们很类似于标准的 Python 类型(不带尾随下划线)和从它们继承(除了 bool_object_).它们可以用来代替标准 Python 类型想要的.每当数据类型是需要,作为参数,标准Python 类型也被识别.

The array types bool_, int_, complex_, float_, object_, unicode_, and str_ are enhanced-scalars. They are very similar to the standard Python types (without the trailing underscore) and inherit from them (except for bool_ and object_). They can be used in place of the standard Python types whenever desired. Whenever a data type is required, as an argument, the standard Python types are recognized as well.

这篇关于带下划线的 NumPy 类型:`int_`、`float_` 等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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