solve the problem
return object.__getattribute__(self, name)
AttributeError: ‘DataFrame’ object has no attribute ‘tolist’
Solution ideas
Property error: ‘dataframe’ object does not have property ‘tolist’
Solution:
Remember that DataFrame does not have a tolist() method, but series.Series has a tolist() method, so it needs to be modified
take
import pandas as pd
#Read xls file
file_path='data/test1226.xls'
data_frame_xls=pd.read_excel(file_path)
data_df01 = data_frame_xls[['age']]
print(type(data_df01))
print(res)
Change to
import pandas as pd
#Read xls file
file_path='data/test1226.xls'
data_frame_xls=pd.read_excel(file_path)
data_df01 = data_frame_xls[['age']]
print(type(data_df01))
data_df01 = data_frame_xls['age']
print(type(data_df01 ))
res = data_df01 .tolist()
print(res)
Ha ha, it’s done!