def explore_02_bar_counties_count(df_to_explore): # Transform the dataset for exploration find_criteria_total = df_to_explore['criteria_tidy'] == 'TOTAL MARK' find_year_2019 = df_to_explore['year'] == 2019 choose_rows = find_criteria_total & find_year_2019 output_df = df_to_explore[choose_rows].sort_values(by=['county_l1']) # Make a plot, and write it to a .png file output_file_name = 'output/cleaner_marks_df_2014_02_bar_counties_count.png' output_plot = { 'df_x': 'county_l1', 'df_y': 'mark', 'estimator': np.count_nonzero, 'title': 'Adjudicated towns by counties for 2019', 'x_label': 'County', 'y_label': 'Towns' } barplot_df_to_png(output_df, output_file_name, output_plot, (6.6, 1))
def explore_05_bar_categories_marks_median(df_to_explore): # Transform the dataset for exploration find_criteria_total = df_to_explore['criteria_tidy'] == 'TOTAL MARK' find_year_2019 = df_to_explore['year'] == 2019 choose_rows = find_criteria_total & find_year_2019 output_df = df_to_explore[choose_rows].sort_values(by=['category']) # Make a plot, and write it to a .png file output_file_name = 'output/cleaner_marks_df_2014_05_bar_categories_marks_median.png' output_plot = { 'df_x': 'category', 'df_y': 'mark', 'estimator': np.median, 'ylim': (270, 350), 'title': 'Median \'TOTAL MARK\' by categories for 2019', 'x_label': 'Category', 'y_label': 'Median Mark' } barplot_df_to_png(output_df, output_file_name, output_plot, (3.2, 1))