从dask读取并行Excel工作表 [英] Parallel excel sheet read from dask

查看:198
本文介绍了从dask读取并行Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您好到目前为止,我遇到的所有使用dask的示例都是
是使用dask read_csv
调用读取的文件夹中的多个csv文件。

Hello All the examples that I came across for using dask thus far has been multiple csv files in a folder being read using dask read_csv call.

如果为我提供了带有多个标签的xlsx文件,我可以在快速使用
来并行读取它们吗?

if I am provided an xlsx file with multiple tabs, can I use anything in dask to read them parallely?

PS我在python 2.7中使用了熊猫0.19.2

P.S. I am using pandas 0.19.2 with python 2.7

推荐答案

对于使用Python 3.6的用户:

For those using Python 3.6:

#reading the file using dask
import dask
import dask.dataframe as dd
from dask.delayed import delayed

parts = dask.delayed(pd.read_excel)(excel_file, sheet_name=0, usecols = [1, 2, 7])
df = dd.from_delayed(parts)

print(df.head())

我看到加载速度提高了50%在i7、16GB第五代计算机上。

I'm seeing a 50% speed increase on load on a i7, 16GB 5th Gen machine.

这篇关于从dask读取并行Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆