在Azure ML Studio中将 pandas 更新到版本0.19 [英] Updating pandas to version 0.19 in Azure ML Studio

查看:75
本文介绍了在Azure ML Studio中将 pandas 更新到版本0.19的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很想访问pandas 0.19中的某些更新功能,但是Azure ML studio使用pandas 0.18作为Anaconda 4.0捆绑包的一部分.有没有办法更新执行Python脚本"组件中使用的版本?

解决方案

我为您提供以下步骤,向您展示如何更新Execute Python Script中的pandas库版本.

第1步 :使用virtualenv组件在系统中创建一个独立的python运行时环境.没有.

如果安装成功,则可以在python/Scripts文件中看到它.

<强> 步骤2 :执行commad创建独立Python运行时环境

第3步 :然后进入创建目录的Scripts文件夹并激活它(此步骤很重要,请不要错过它)

请不要关闭此命令窗口,并使用pip install pandas==0.19在此命令窗口中下载外部库.

第4步 :将Lib/site-packages文件夹中的所有文件压缩为zip包(我称之为pandas-此处为包)

步骤5 :将zip包上传到Azure Machine Learning WorkSpace数据集.

特定步骤,请参考技术说明.

成功后,您将在数据集列表"中看到上载的软件包

步骤6 :在Execute Python Script模块中定义方法azureml_main之前,您需要删除旧的pandas模块&其依赖项,然后再次导入pandas,如下所示.

import sys
import pandas as pd
print(pd.__version__)
del sys.modules['pandas']
del sys.modules['numpy']
del sys.modules['pytz']
del sys.modules['six']
del sys.modules['dateutil']
sys.path.insert(0, '.\\Script Bundle')
for td in [m for m in sys.modules if m.startswith('pandas.') or m.startswith('numpy.') or m.startswith('pytz.') or m.startswith('dateutil.') or m.startswith('six.')]:
    del sys.modules[td]
import pandas as pd
print(pd.__version__)
# The entry point function can contain up to two input arguments:
#   Param<dataframe1>: a pandas.DataFrame
#   Param<dataframe2>: a pandas.DataFrame
def azureml_main(dataframe1 = None, dataframe2 = None):

然后您可以从以下日志中看到结果,首先打印旧版本0.14.0,然后从上载的zip文件中打印新版本0.19.0.

[Information]         0.14.0
[Information]         0.19.0

您还可以参考以下主题:访问在Azure中使用时间戳记的blob文件重新加载并重新加载.

希望它对您有帮助.

I would really like to get access to some of the updated functions in pandas 0.19, but Azure ML studio uses pandas 0.18 as part of the Anaconda 4.0 bundle. Is there a way to update the version that is used within the "Execute Python Script" components?

解决方案

I offer the below steps for you to show how to update the version of pandas library in Execute Python Script.

Step 1 : Use the virtualenv component to create an independent python runtime environment in your system.Please install it first with command pip install virtualenv if you don't have it.

If you installed it successfully ,you could see it in your python/Scripts file.

Step2 : Run the commad to create independent python runtime environment.

Step 3 : Then go into the created directory's Scripts folder and activate it (this step is important , don't miss it)

Please don't close this command window and use pip install pandas==0.19 to download external libraries in this command window.

Step 4 : Compress all of the files in the Lib/site-packages folder into a zip package (I'm calling it pandas - package here)

Step 5 :Upload the zip package into the Azure Machine Learning WorkSpace DataSet.

specific steps please refer to the Technical Notes.

After success, you will see the uploaded package in the DataSet List

Step 6 : Before the defination of method azureml_main in the Execute Python Script module, you need to remove the old pandas modules & its dependencies, then to import pandas again, as the code below.

import sys
import pandas as pd
print(pd.__version__)
del sys.modules['pandas']
del sys.modules['numpy']
del sys.modules['pytz']
del sys.modules['six']
del sys.modules['dateutil']
sys.path.insert(0, '.\\Script Bundle')
for td in [m for m in sys.modules if m.startswith('pandas.') or m.startswith('numpy.') or m.startswith('pytz.') or m.startswith('dateutil.') or m.startswith('six.')]:
    del sys.modules[td]
import pandas as pd
print(pd.__version__)
# The entry point function can contain up to two input arguments:
#   Param<dataframe1>: a pandas.DataFrame
#   Param<dataframe2>: a pandas.DataFrame
def azureml_main(dataframe1 = None, dataframe2 = None):

Then you can see the result from logs as below, first print the old version 0.14.0, then print the new version 0.19.0 from the uploaded zip file.

[Information]         0.14.0
[Information]         0.19.0

You could also refer to these threads: Access blob file using time stamp in Azure and reload with reset.

Hope it helps you.

这篇关于在Azure ML Studio中将 pandas 更新到版本0.19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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