I have an Excel file which has numerical data of a matrix of dimension 30 x 30
. I am trying to read it and access individual element as normally done. But I am getting a list instead of a single element.
Code
import pandas as pd
import numpy as np
xl = pd.ExcelFile('sample.xlsx')
df1 = xl.parse('Sheet1')
data = np.matrix(df1)
print(data.shape)
print(data[0])
print(data[0][0])
Output
(30, 30)
[[ 0 0 7 0 4 0 3 0 0 7 4 0 0 0 3 2 0 0 0 0 4 0 0 0
0 0 4 0 10 3]]
[[ 0 0 7 0 4 0 3 0 0 7 4 0 0 0 3 2 0 0 0 0 4 0 0 0
0 0 4 0 10 3]]
Any thoughts