计算pandasDataF 您可以使用value_counts和to_dict: print df['status'].value_counts()N 14S 4C 2Name: status, dtype: int64counts = df['status'].value_counts().to_dict()print counts{'S': 4, 'C': 2, 'N': 14}
您可以使用value_counts和to_dict:
print df['status'].value_counts()N 14S 4C 2Name: status, dtype: int64counts = df['status'].value_counts().to_dict()print counts{'S': 4, 'C': 2, 'N': 14}