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数组相关推荐

  1. python数组相减_对Python 中矩阵或者数组相减的法则详解

    对Python 中矩阵或者数组相减的法则详解 最近在做编程练习,发现有些结果的值与答案相差较大,通过分析比较得出结论,大概过程如下: 定义了一个计算损失的函数: def error(yhat,labe ...

  2. python数组赋值_对Python中列表和数组的赋值,浅拷贝和深拷贝的实例讲解

    对Python中列表和数组的赋值,浅拷贝和深拷贝的实例讲解 列表赋值: >>> a = [1, 2, 3] >>> b = a >>> print ...

  3. 【CV】Numpy|Python中矩阵和数组乘法及向量相关问题

    在numpy中 一维数组不是向量,但可以通过reshape转换成行向量或者列向量 Numpy库学习--向量表示_o_Eagle_o-CSDN博客 一维数组左乘矩阵时,把数组看做行向量 一维数组右乘矩阵 ...

  4. 如何在Python中声明一个数组?

    如何在Python中声明数组? 我在文档中找不到任何对数组的引用. #1楼 这个怎么样... >>> a = range(12) >>> a [0, 1, 2, 3 ...

  5. 一文搞懂Python中的所有数组数据类型

    数组类型是各种编程语言中基本的数组结构了,本文来盘点下Python中各种"数组"类型的实现. list tuple array.array str bytes bytearray ...

  6. python中链表和数组_Python

    下载好向圈APP可以快速联系圈友 您需要 登录 才可以下载或查看,没有帐号?立即注册 x Python 算法 03-- 数组和链表(下)-1.jpg (93.27 KB, 下载次数: 0) 2020- ...

  7. python中多维数组_python学习笔记-多维数组

    Python中初始化一个5 x 3每项为0的数组,最好方法是: multilist = [[0 for col in range(5)] for row in range(3)] 我们知道,为了初始化 ...

  8. python binascii array('c')_详解Python中的array数组模块相关使用

    初始化array实例化可以提供一个参数来描述允许那种数据类型,还可以有一个初始的数据序列存储在数组中. import array import binascii s = 'This is the ar ...

  9. python数组类型_一文搞懂Python中的所有数组数据类型

    关于我 编程界的一名小小程序猿,目前在一个创业团队任team lead,技术栈涉及Android.Python.Java和Go,这个也是我们团队的主要技术栈. 联系:hylinux1024@gmail ...

最新文章

  1. Twitter能为你做什么?
  2. PHPExcel处理导入导出图片,链接
  3. 怎样在计算机页面加密,怎么给文件加密并加密后隐藏起来?
  4. 数据库(四)之数据库表管理
  5. Python itertools库详细教程
  6. 2020数学建模国赛C题思路
  7. 某公司的雇员分为以下若干类: Employee:这是所有员工总的父类, 属性: 员工的姓名,员工的生日月份。 方法:getSalary(
  8. Logistic 梯度法进行分类
  9. 项目奖金一般是多少_二级建造师一个月薪资平均有多少?
  10. eclipse 使用lombok 出现的问题
  11. 主板有电无法启动_电脑无法开机?这篇文章让你省下几百修理费
  12. Docker 以 docker 方式运行 jenkins
  13. LeetCode 之 JavaScript 解答第98题 —— 验证二叉搜索树(Validate Binary Search Tree)
  14. AngularJS Documents 官方英文文档
  15. Jfinal weixin源码分析---碎碎念(看最后,有福利)
  16. 【数学建模笔记 22】数学建模的模糊数学模型
  17. 进销存excel_(升级版)进销存管理系统,含Excel函数公式全自动,高效率
  18. 高德地图获取城市所有小区的POI
  19. 《矛盾论》与《实践论》
  20. 程序员都是这样关机的

热门文章

  1. 数据持化技术的发展演变(SQL、JDBC、mybatis)
  2. .size .shape .size() type的运用
  3. Linux 出现Permission denied的解决办法
  4. SPS2003升级到MOSS2007相关资料及问题总结
  5. 发送邮件程序报错454 Authentication failed以及POP3和SMTP简介
  6. 【转载】细聊冗余表数据一致性(架构师之路)
  7. LaTeX技巧205:使用split输入多行公式技巧
  8. 第一个Android工程HelloAndroid
  9. 详解模板方法设计模式
  10. java手机状态栏圆形图标,android实现状态栏添加图标的函数实例