Python Pandas DataFrame仅存储一个数字吗? [英] Python Pandas DataFrame with only a single number stored?
本文介绍了Python Pandas DataFrame仅存储一个数字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AzureML的Python脚本模块需要返回Pandas DataFrame.我只想返回一个值,我这样做:
AzureML's Python Script module requires to return a Pandas DataFrame. I want to return only a value and I do this:
result=7
dataframe1=pd.DataFrame(numpy.zeros(1))
dataframe1[0][0]=result
通过它我只能在Azure ML的Python脚本模块中返回单个值.
by which I am able to return just a single value in Azure ML's Python Script module.
创建具有单个值的pandas DataFrame的正确方法是什么?
推荐答案
以下代码应该可以工作:
Following code should work:
import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
result = pd.DataFrame({'mycol': [123]})
return result,
这篇关于Python Pandas DataFrame仅存储一个数字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文