此问题基于用户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脚本模块的限制。