Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.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 转换类';pandas.index.numeric.Int64Index';阉割_Python_Numpy_Pandas_Dataframe - Fatal编程技术网

Python 转换类';pandas.index.numeric.Int64Index';阉割

Python 转换类';pandas.index.numeric.Int64Index';阉割,python,numpy,pandas,dataframe,Python,Numpy,Pandas,Dataframe,我正在从Pandas数据帧中隔离一些行ID,如下所示: data = df.loc[df.cell == id] rows = df.index print(type(rows)) < class 'pandas.indexes.numeric.Int64Index'> 请问正确的方法是什么?谢谢试试rows=df.index.values我想OP需要df.loc[df.cell==id.index.values。如果他们确认,您可以更新您的答案。 row_mat = rows.

我正在从Pandas数据帧中隔离一些行ID,如下所示:

data = df.loc[df.cell == id]
rows = df.index

print(type(rows))
< class 'pandas.indexes.numeric.Int64Index'>

请问正确的方法是什么?谢谢

试试
rows=df.index.values
我想OP需要
df.loc[df.cell==id.index.values
。如果他们确认,您可以更新您的答案。
row_mat = rows.as_matrix()
AttributeError: 'Int64Index' object has no attribute 'as_matrix'