import pandas as pd import streamlit as st import plotly.express as px from query.requetes import ( query_zone_catg_prop, query_mon_wise_prop, query_practice_mon_wise, query_zone_per_species, ) def dashboard( list_category, list_months, list_regions, list_department, list_species, list_practices, ): df_zone_catg_prop = query_zone_catg_prop(list_category) df_mon_wise_prop = query_mon_wise_prop(list_species, list_months) df_practice_mon_wise = query_practice_mon_wise(list_practices, list_months) df_zone_per_species = query_zone_per_species( list_species, list_regions, list_department ) MONTHS = [ "janvier", "fevrier", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "decembre", ] MONTH_MAPPING = {k: v + 1 for v, k in enumerate(MONTHS)} # Add a numeric_months column based on MONTH_MAPPING df_practice_mon_wise["numeric_months"] = df_practice_mon_wise["months"].map( MONTH_MAPPING ) df_mon_wise_prop["numeric_months"] = df_mon_wise_prop["months"].map(MONTH_MAPPING) # Sort by numeric_months and reset index before dropping it df_practice_mon_wise = df_practice_mon_wise.sort_values( ["numeric_months", "species_id"] ).reset_index(drop=True) df_practice_mon_wise.drop("numeric_months", axis=1, inplace=True) df_mon_wise_prop = df_mon_wise_prop.sort_values( ["numeric_months", "proportion"] ).reset_index(drop=True) df_mon_wise_prop.drop("numeric_months", axis=1, inplace=True) st.markdown( """