日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

python中astype用法_python里的astype是什么意思?(Python.org)

發布時間:2023/12/15 综合教程 30 生活家
生活随笔 收集整理的這篇文章主要介紹了 python中astype用法_python里的astype是什么意思?(Python.org) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

展開全部

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 數組元素的類型

3,astype 修改數據類型

擴展資料

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

總結

以上是生活随笔為你收集整理的python中astype用法_python里的astype是什么意思?(Python.org)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。