Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中的多重索引_Python_Pandas_Jupyter Notebook - Fatal编程技术网

python中的多重索引

python中的多重索引,python,pandas,jupyter-notebook,Python,Pandas,Jupyter Notebook,我正在使用jypyther python。我通过以下方式创建了一个数据集: scr_spread=pd.read_csv('C:/Users/e877780/Desktop/DEV/scr_spread.txt',sep=";") #scr_spread['idx']=range(1,len(scr_spread)+1) scr_spread.set_index(['Tipo','Rating','Duration_hasta'], inplace=True) scr_spread=scr_sp

我正在使用jypyther python。我通过以下方式创建了一个数据集:

scr_spread=pd.read_csv('C:/Users/e877780/Desktop/DEV/scr_spread.txt',sep=";")
#scr_spread['idx']=range(1,len(scr_spread)+1)
scr_spread.set_index(['Tipo','Rating','Duration_hasta'], inplace=True)
scr_spread=scr_spread.sort_index()
数据集还有一个字段“Duramaxima”。我试图得到对应于三元组的“Duramaxima”,例如(1,1,5)。我使用以下语法:

scr_spread.loc[(1,1,5),'DuraMaxima']
如果我从上面定义a=2*值并打印输出,我会得到以下结果:

我怎么才能得到346,而不是乘法的三元组加结果呢。我需要另一个数据集的346。
感谢当使用tuple访问
.loc
中的某一行时,它将返回pandas系列。
因此,通过
print(a.iloc[0])
您仅获得346。

当您尝试
a.values
时会发生什么?