Если у меня есть такой фрейм данных:
id s scene
1 a kitchen: 0.297, living: 0.515, degree: A
2 b kitchen: 0.401, study: 0.005, degree: A
3 c study: 0.913, degree: B
4 d living: 0.515, degree: B
5 e others: 0.1, degree: C
Как получить новый фрейм данных с помощью Pandas следующим образом.
Пока я пробовал df[['id', 's', 'kitchen', 'living', 'study', 'others', 'degree']] = df['scene'].str.split(',', expand=True)
:
id s kitchen living study others degree
1 a 0.297 0.515 0 0 A
2 b 0.401 0 0.005 0 A
3 c 0 0 0.913 0 B
4 d 0 0.515 0 0 B
5 e 0 0 0 0.1 C