<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 MD Top 15 violations by total revenue (revenue and total)
Step1:  Areas to explore
Failure to secure dc tags --- huge revenue maker
Residential Parking beyond permit period
Park at Expired Meter
MD Top 15 violations by total tickets (revenue and total)
<ASSISTANT_TASK:>
Python Code:
dc_df = df[(df.rp_plate_state.isin(['MD']))]
dc_fines = dc_df.groupby(['violation_code']).fine.sum().reset_index('violation_code')
fine_codes_15 = dc_fines.sort_values(by='fine', ascending=False)[:15]
top_codes = dc_df[dc_df.violation_code.isin(fine_codes_15.violation_code)]
top_violation_by_state = top_codes.groupby(['violation_description']).fine.sum()
ax = top_violation_by_state.plot.barh()
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0f'))
plt.draw()
top_violation_by_state = top_codes.groupby(['violation_description']).counter.sum()
ax = top_violation_by_state.plot.barh()
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0f'))
plt.draw()
Explanation: MD Top 15 violations by total revenue (revenue and total)
End of explanation
dc_df = df[(df.rp_plate_state.isin(['MD']))]
dc_fines = dc_df.groupby(['violation_code']).counter.sum().reset_index('violation_code')
fine_codes_15 = dc_fines.sort_values(by='counter', ascending=False)[:15]
top_codes = dc_df[dc_df.violation_code.isin(fine_codes_15.violation_code)]
top_violation_by_state = top_codes.groupby(['violation_description']).fine.sum()
ax = top_violation_by_state.plot.barh()
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0f'))
plt.draw()
top_violation_by_state = top_codes.groupby(['violation_description']).counter.sum()
ax = top_violation_by_state.plot.barh()
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0f'))
plt.draw()
Explanation: Areas to explore
Failure to secure dc tags --- huge revenue maker
Residential Parking beyond permit period
Park at Expired Meter
MD Top 15 violations by total tickets (revenue and total)
End of explanation
<END_TASK>