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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

Python中的Dask数组

發布時間:2025/3/11 python 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Python中的Dask数组 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Python Dask數組 (Python Dask Array)

Dask is parallel computing python library and it is mainly used to run across multiple systems. Dask is used to process the data efficiently on a different cluster of machines. Dask can completely use all the cores available in the machine.

Dask是并行計算的python庫,主要用于跨多個系統運行。 Dask用于在其他計算機群集上有效地處理數據。 Dask可以完全使用機器中可用的所有內核。

Dask stores the complete data on the disk and uses chunks of data from the disk for processing. Dask analyzes the large data sets with the help of Pandas data frame and "numpy arrays".

Dask將完整的數據存儲在磁盤上,并使用磁盤中的數據塊進行處理。 Dask借助Pandas數據框和“ numpy數組” 來分析大型數據集。

Basically, dask arrays are distributed "numpy arrays". A large "numpy array" is divided into smaller arrays and they are grouped together to form dask array.

基本上, dask數組是分布式的“ numpy數組”。 大的“ numpy數組”分為較小的數組,它們組合在一起形成dask數組 。

Install using this command:

使用以下命令進行安裝:

pip install dask

Dask array.asarray is used to convert the given input into dask array. It converts lists, tuples, numpy array to dask array.

Dask array.asarray用于將給定的輸入轉換為dask array 。 它將列表,元組,numpy數組轉換為dask數組 。

Program to create a dask array:

程序創建一個dask數組:

Example #1:

范例1:

import dask.array as p rk = [1,2,3,4,5] #converts the list into dask array d=p.asarray(rk) print(d.compute()) #print type of d print(type(d)) r = (1,2,3) #converts the tuple into dask array k=p.asarray(r) print(k.compute()) #print type of k print(type(k))

Output

輸出量

[1 2 3 4 5] <class 'dask.array.core.Array'> [1 2 3] <class 'dask.array.core.Array'>

Example #2:

范例2:

import dask.array as p import numpy as np #create a numpy array r=np.arange(5) print(r) #print type of numpy array print(type(r)) #converting numpy array to dask array d=p.asarray(r) print(d.compute()) print(type(d)) t=np.array([1,2,3]) print(t) #print type of numpy array print(type(t)) #converting numpy array to dask array f=p.asarray(t) print(f.compute()) #print type of dask array print(type(f))

Output

輸出量

[0 1 2 3 4] <class 'numpy.ndarray'> [0 1 2 3 4] <class 'dask.array.core.Array'> [1 2 3] <class 'numpy.ndarray'> [1 2 3] <class 'dask.array.core.Array'>

翻譯自: https://www.includehelp.com/python/dask-array.aspx

總結

以上是生活随笔為你收集整理的Python中的Dask数组的全部內容,希望文章能夠幫你解決所遇到的問題。

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