python - 在 Azure ML Studio 中更新 pandas 会导致错误
问题描述
此问题基于用户 user4446237 提出的另一个问题的解决方案:Updating pandas to version 0.19 in Azure ML Studio
我已按照答案中提供的步骤进行操作,最后我还得到了信息,即我导入了新版本的熊猫(0.23.3)而不是熊猫(0.18.0)。但是,在检索包的版本后,代码会遇到错误:
Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 192, in batch
idfs = [parameter for infile in infiles
File "C:\server\invokepy.py", line 194, in <listcomp>
infile, is_buffer=False)]
File "C:\server\XDRReader\xdrutils.py", line 47, in XDRToPyObjects
return XDRBridge.xdr_to_py_positional(attrList)
File "C:\server\XDRReader\xdrbridge.py", line 216, in xdr_to_py_positional
retList.append(XDRBridge.xdrobject_to_dataframe(key, value))
File "C:\server\XDRReader\xdrbridge.py", line 155, in xdrobject_to_dataframe
}, index=np.arange(len(columns[0].values())), copy=False)
File "C:\pyhome\lib\site-packages\pandas\core\frame.py", line 223, in __init__
mgr = self._init_dict(data, index, columns, dtype=dtype)
File "C:\pyhome\lib\site-packages\pandas\core\frame.py", line 356, in _init_dict
columns = data_names = Index(keys)
File "C:\pyhome\lib\site-packages\pandas\indexes\base.py", line 129, in __new__
from .range import RangeIndex
SystemError: Parent module 'pandas.indexes' not loaded, cannot perform relative import
我使用的代码与 Jay Gong 的代码几乎相同:
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):
对于这个问题我能做些什么,或者我是否达到了 Azure ML Studio 的 Python 脚本模块的限制。
解决方案
推荐阅读
- java - 交换 JFrame 两次后 JFrame 显示为空白(使用 Intellij GUI 设计器)
- java - 无法将类型“java.lang.String”的属性值转换为属性“日期”所需的类型“java.util.Date”:它不完全是 10 个字符长
- node.js - 获取对等客户端证书的套接字 io 始终返回空对象
- php - 从错误页面的标签标题中删除“Wordpress”
- c# - C# 条件编译中是否有 OR 运算符?
- javascript - 在 stat 方法之前检查权限以避免错误
- perl - perl STDIN 到子程序
- coinbase-api - HTTP 400 错误:大小太准确。最小单位是 0.00000001
- reactjs - 如何使用 jest 和酶测试具有异步功能的 React 组件
- python - python日志控制台和文件输出包含重复的消息