答案 0 :(得分:0)
使用以下示例数据框(最小,但基于您的图像):
>>> df
Data Visualization Machine Learning Statistics
0 Not Interested Somewhat Interested Very Interested
1 Not Interested Not Interested Somewhat Interested
2 Somewhat Interested Not Interested Very Interested
3 Somewhat Interested Not Interested Somewhat Interested
4 Very Interested Very Interested Not Interested
您可以使用value_counts
:
df.apply(lambda x: x.value_counts()).T
Not Interested Somewhat Interested Very Interested
Data Visualization 2 2 1
Machine Learning 3 1 1
Statistics 1 2 2