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

python中astype用法_python里的astype是什么意思?展开全部astype是实现2113变量类型转换,例如astype(type):returnsacopyofthearrayconvertedtothespecifiedtype.a=a.astype(‘Float64’)b=b.astype(‘Int32’)Python中与数据5261类型4102相关函数及属性1653有如下三个:type/dtype/astypetyp…

大家好,又见面了,我是你们的朋友全栈君。

展开全部

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.21052632 1.42105263 1.63157895 1.84210526 2.05263158

2.26315789 2.47368421 2.68421053 2.89473684 3.10526316 3.31578947

3.52631579 3.73684211 3.94736842 4.15789474 4.36842105 4.57894737

4.78947368 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://javaforall.net/133413.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

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

关注全栈程序员社区公众号