在另一个列标题中访问列 [英] Access column with in another column header

查看:95
本文介绍了在另一个列标题中访问列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在python中打开了.mat文件.我可以看到CloudData中有一个名为'CloudData'的主列,还有'Points'和'RGB'两列.我可以使用以下方法访问积分"列:

I opened a .mat file in python. I can see that there is one main column named 'CloudData' within the CloudData there are two columns 'Points' and 'RGB'. I can access the Points columns by using:

points_data=(data['CloudData']['Points'][0:1])

其中data是使用scipy.io在python中读取的文件的名称.但是当我尝试读取数据值时,它位于RGB内部,如下所示:

where data is the name of the file read in python using scipy.io. But when i try to read the data values, which is inside RGB as below:

channel_data=(data['RGB']['data_values']) 

我收到错误消息: KeyError:"RGB"

I get the error complaining: KeyError: 'RGB'

在python中打开.mat文件后,是否需要考虑什么? 实际上,在Matlab中,变量data_values在变量查看器窗口中以CloudData.RGB.data_values作为标题显示.

Is there any consideration to be taken after opening .mat file in python? Actually in the Matlab, the variable data_values is displayed with CloudData.RGB.data_values as title on the variable viewer window.

第一步,我想读取位于CloudData内的RGB标头内的值.

For the first step, i want to read the values inside the RGB header, which is inside CloudData.

推荐答案

从您写的内容看来,您应该使用

访问RGB

From what you wrote it looks to me that you should access RGB with

channel_data = (data['CloudData']['RGB'][0:1])

channel_data = (data['CloudData']['RGB']['data_values'][0:1])

取决于您在Matlab中构造.mat文件的方式.

depending on how you .mat file is constructed in matlab.

这篇关于在另一个列标题中访问列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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