假设你有
color_df # dataframe object
你可以这样做:
result_df = color_df.groupby('is_trans').count() print(result_df) # should give you what you ask for.
import matplotlib.pyplot as plt vector_of_values = [1,2,3,4,5,6,7,8,9] plt.hist(vector_of_values) plt.show()
如果你想要更多的箱子,你可以更换
plt.hist(vector_of_values)
具有
plt.hist(vector_of_values, bins=100) # or any number of bins you can have