Modin安装前需先安装ray,而ray目前是不支持windows环境的。所以可以先通过WSL进行安装ray后再安装modin。
-
安装wsl
控制面板\程序\程序和功能\启用或关闭 Windows 功能 开启 适用于 Linux 的 Windows 子系统 选项,之后重启电脑
-
打开应用商店,搜索Linux
这里选择的是安装Ubuntu 18.04LTS,双击进去点击安装。
安装完毕后菜单可以看到Ubuntu图标,点击启动,或者cmd里输入 bash.exe 启动。
第一次启动会初始化,稍等会后 提示输入用户名和密码。
-
安装ray,
-
根据官网文档说明进行安装
Install Ray with
pip install -U ray
. For the latest wheels (a snapshot of themaster
branch), you can use the instructions at Latest Snapshots (Nightlies). -
不过可能会提示找不到pip模块问题,检查了发现是有pip的,如果出现该问题可以使用pip.exe进行安装,这里加了个豆瓣的源
pip.exe install -U ray -i https://pypi.doubanio.com/simple/
-
安装ray完毕后可以顺便安装modin,不过此时在windows10环境下安装应该也没什么问题。
pip.exe install modin -i https://pypi.doubanio.com/simple/
-
-
测试modin处理pandas效果
import pandas as pd import numpy as np # ALLOWED def func(x): return x**10 data=np.random.rand(100000,1000) df=pd.DataFrame(data) import time start=time.time() df.apply(func, axis=1) end=time.time() print('original pandas using ' + str(end-start)+' time') import modin.pandas as mpd df=mpd.DataFrame(data) start=time.time() df.apply(func, axis=1) end=time.time() print('modin using ' + str(end-start)+' time')
输出结果
original pandas using 19.34025764465332 time modin using 5.360168695449829 time
效率还是不错的~