<分区>
从 json 读取数据到 pandas 时,读取了多标准酒店评级列,如下所示。我的数据框 Ratings 和 ReviewID 中有 2 列。由于我从一个更大的 Json 读取数据框,因此 Rating 列对每个评论者都有一个条目,其形式为:
`result.head()
Ratings ReviewID
0 {'Service': '5', 'Cleanliness': '5', 'Overall'... 12
1 {'Service': '4', 'Cleanliness': '4', 'Overall'... 54
2 {'Service': '5', 'Cleanliness': '5', 'Overall'... 48
3 {'Service': '5', 'Cleanliness': '5', 'Overall'... 90
4 {'Service': '5', 'Cleanliness': '5', 'Overall'... 75`
我的目的是将评级列分为 7 个不同的列,每个列都有各自的标准值:`
ReviewID Service Cleanliness Value Rooms Location Check-in Desk Overall
27 1 1 5 4 5 5 5 4
9 1 5 5 5 5 4 3 5
22 6 3 2 4 3 3 3 3`
任何有格式建议的人都会有很大帮助..