<jupyter_start><jupyter_text>Get the top 15 violations by total tickets<jupyter_code>vc_df = dmv_df.groupby(['violation_code']).counter.sum().reset_index('violation_code')
counter_codes_15 = vc_df.sort_values(by='counter', ascending=False)[:15].violation_code
top_codes = dmv_df[dmv_df.violation_code.isin(counter_codes_15)]
top_violation_by_state = top_codes.groupby(['violation_description', 'rp_plate_state']).counter.sum() #.unstack().unstack().unstack()
top_violation_by_state.unstack().plot.barh()
top_violation_by_state_revenue = top_codes.groupby(['violation_description', 'rp_plate_state']).fine.sum() 
ax = top_violation_by_state_revenue.unstack().plot.barh(legend=True)

ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0f'))

plt.draw()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14923469387755103, 'fraction_numerical': 0.011479591836734694, 'mean_word_length': 11.46031746031746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '383666', 'license': 'MIT', 'n_tokens_mistral': 306, 'n_tokens_neox': 290, 'n_words': 26, 'path': 'notebooks/Top 15 violations by Total Tickets Analysis.ipynb', 'repo_name': 'ndanielsen/dc_parking_violations_data', 'size': '784'}