Convert class 'pandas.indexes.numeric.Int64Index' to numpy

I highlight some string identifiers from the Pandas frame, for example:

data = df.loc[df.cell == id] rows = df.index print(type(rows)) < class 'pandas.indexes.numeric.Int64Index'> 

I want to convert strings to a numpy array in order to save it in a mat file using sio.savemat. This returns an error:

 row_mat = rows.as_matrix() AttributeError: 'Int64Index' object has no attribute 'as_matrix' 

What is the right way please? Thanks

+5
source share
1 answer

try rows = df.index.values instead

+12
source

All Articles