问题描述
total_fmok = len(data1)
for col in rare_cols:
# count the number of line item transactions per category label
# and divide by total observations from dataset
# aka percentage of observations per category
temp_df = pd.Series(data1[col].value_counts() / total_fmok)
# make plot with the above percentages
fig = temp_df.sort_values(ascending=False).nlargest(30).plot.bar(figsize=(20,10),fontsize=20)
fig.set_xlabel(col)
# add a line at 5 % to flag the threshold for rare categories
fig.axhline(y=0.01,color='red')
fig.set_ylabel('Percentage of Ticket Item Observations')
plt.show()
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)