有没有办法在matlab中导入数据帧并访问数据?

2024-05-14 09:33:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我可以将熊猫数据帧导入matlab,但我无法访问它的数据。我知道我可以将dataframe作为python字典导入,它可以工作,但是我想将其作为python dataframe导入,并对其进行操作或将其转换为数据集或单元格数组

at = py.dat_tests.get_athletes() %Imports the dataframe
def get_athletes():

    a_dict = {'Name' : ['Fred', 'Nick', 'Joe', 'Max'], 'Favorite Sport' : ['Baseball', 'Hockey', 'Handball', 'Basketball'], 'Wins' : [25, 19, 15, 45]}
    dataframe = pd.DataFrame(data=a_dict)
    print(dataframe)

    # Returning athletes as a python dictionary works...
    athletes = dataframe.to_dict() 

    return dataframe 

来自非单元格数组对象的单元格内容引用


Tags: the数据pydataframeget字典deftests

热门问题