Bokeh: AttributeError: 'DataFrame' object has no attribute 'tolist'
You are using tolist
incorrectly. You want: .values
followed by tolist()
type tsneX tsneY
0 A 53.828863 20.740931
1 B 57.816909 18.478468
2 A 55.913429 22.948167
3 C 56.603005 15.738954
For the above dataframe, to get your X and Y values as a list you can do:
tsneY_data = df['tsneY'].values.tolist()
>> [20.740931, 18.478468, 22.948167, 15.7389541]
tsneX_data = df['tsneX'].values.tolist()
>> [53.828863, 57.816909, 55.913429, 56.603005]
As you have tried to set this to the column of a new dataframe, you can do:
new_data = pd.DataFrame()
new_data['tsneY'] = df['tsneY'].values.tolist()
> new_data
tsneY
0 20.740931
1 18.478468
2 22.948167
3 15.738954