python中astype用法_python里的astype是什么意思?

python中astype用法_python里的astype是什么意思?展开全部 astype 是实现 2113 变量类型转换 例如 astype type returnsacopy a a astype

大家好,欢迎来到IT知识分享网。

展开全部

astype是实现2113变量类型转换,例如

astype(type): returns a copy of the array converted to the specified type.a =

a.astype(‘Float64’)b = b.astype(‘Int32’)

Python中与数据5261类型4102相关函数及属性1653有如下三个:type/dtype/astype

type() 返回参数的数据类型

dtype 返回数组中元素的数据类型

astype() 对数据类型进行转换

python中type dtype astype 的用法

1,type 获取数据类型

2,dtype 数组元素的类型

resize,m_lfit,w_600,h_800,limit_1

3,astype 修改数据类型

resize,m_lfit,w_600,h_800,limit_1

扩展资料

python里的astype的运用代码:

#astype的应用

e=np.linspace(1,5,20)

print(e)

#>>>

[1. 1. 1. 1. 1. 2.0

2. 2. 2. 2. 3. 3.

3. 3. 3. 4. 4. 4.

4. 5. ]

”’

print(e.dtype)

#>>>float64

e=e.astype(int)

print(e)

#>>>[1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 5]

print(e.dtype)

#>>>int64

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/114665.html

(0)
上一篇 2025-12-07 15:26
下一篇 2025-12-07 15:45

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信