import pandas as pd sdg_column_mapping = { 0:[ 'Goal_Rating', 'Goal_Trend', 'Value_sdg_earlyedu', 'Year_sdg_earlyedu', 'impute_sdg_earlyedu', 'Score_sdg_earlyedu', 'Rating_sdg_earlyedu', 'Trend_sdg_earlyedu', 'Value_sdg_primary', 'Year_sdg_primary', 'Score_sdg_primary', 'Rating_sdg_primary', 'Trend_sdg_primary', 'Value_sdg_second', 'Year_sdg_second', 'impute_sdg_second', 'Score_sdg_second', 'Rating_sdg_second', 'Trend_sdg_second', 'Value_sdg_literacy', 'Year_sdg_literacy', 'Score_sdg_literacy', 'Rating_sdg_literacy', 'Trend_sdg_literacy', 'Value_sdg_tertiary', 'Year_sdg_tertiary', 'Score_sdg_tertiary', 'Rating_sdg_tertiary', 'Trend_sdg_tertiary', 'Value_sdg_pisa', 'Year_sdg_pisa', 'Rating_sdg_pisa', 'Trend_sdg_pisa', 'Value_sdg_socioec', 'Year_sdg_socioec', 'Rating_sdg_socioec', 'Trend_sdg_socioec', 'Value_sdg_science', 'Year_sdg_science', 'Rating_sdg_science', 'Trend_sdg_science',], 3:[ 'Goal_3_Rating', 'Goal_3_Trend', 'Value_sdg3_matmort', 'Year_sdg3_matmort', 'Score_sdg3_matmort', 'Rating_sdg3_matmort', 'Trend_sdg3_matmort', 'Value_sdg3_neonat', 'Year_sdg3_neonat', 'Score_sdg3_neonat', 'Rating_sdg3_neonat', 'Trend_sdg3_neonat', 'Value_sdg3_u5mort', 'Year_sdg3_u5mort', 'Score_sdg3_u5mort', 'Rating_sdg3_u5mort', 'Trend_sdg3_u5mort', 'Value_sdg3_tb', 'Year_sdg3_tb', 'Score_sdg3_tb', 'Rating_sdg3_tb', 'Trend_sdg3_tb', 'Value_sdg3_hiv', 'Year_sdg3_hiv', 'Score_sdg3_hiv', 'Rating_sdg3_hiv', 'Trend_sdg3_hiv', 'Value_sdg3_ncds', 'Year_sdg3_ncds', 'Score_sdg3_ncds', 'Rating_sdg3_ncds', 'Trend_sdg3_ncds', 'Value_sdg3_pollmort', 'Year_sdg3_pollmort', 'Score_sdg3_pollmort', 'Rating_sdg3_pollmort', 'Value_sdg3_traffic', 'Year_sdg3_traffic', 'Score_sdg3_traffic', 'Rating_sdg3_traffic', 'Trend_sdg3_traffic', 'Value_sdg3_lifee', 'Year_sdg3_lifee', 'Score_sdg3_lifee', 'Rating_sdg3_lifee', 'Trend_sdg3_lifee', 'Value_sdg3_fertility', 'Year_sdg3_fertility', 'Score_sdg3_fertility', 'Rating_sdg3_fertility', 'Trend_sdg3_fertility', 'Value_sdg3_births', 'Year_sdg3_births', 'Score_sdg3_births', 'Rating_sdg3_births', 'Trend_sdg3_births', 'Value_sdg3_vac', 'Year_sdg3_vac', 'Score_sdg3_vac', 'Rating_sdg3_vac', 'Trend_sdg3_vac', 'Value_sdg3_uhc', 'Year_sdg3_uhc', 'Score_sdg3_uhc', 'Rating_sdg3_uhc', 'Trend_sdg3_uhc', 'Value_sdg3_swb', 'Year_sdg3_swb', 'Score_sdg3_swb', 'Rating_sdg3_swb', 'Trend_sdg3_swb', 'Value_sdg3_region', 'Year_sdg3_region', 'Rating_sdg3_region', 'Trend_sdg3_region', 'Value_sdg3_incomeg', 'Year_sdg3_incomeg', 'Rating_sdg3_incomeg', 'Trend_sdg3_incomeg', 'Value_sdg3_smoke', 'Year_sdg3_smoke', 'Rating_sdg3_smoke', 'Trend_sdg3_smoke', ], 4: [ 'Goal_4_Rating', 'Goal_4_Trend', 'Value_sdg4_earlyedu', 'Year_sdg4_earlyedu', 'Score_sdg4_earlyedu', 'Rating_sdg4_earlyedu', 'Value_sdg4_primary', 'Year_sdg4_primary', 'Score_sdg4_primary', 'Rating_sdg4_primary', 'Trend_sdg4_primary', 'Value_sdg4_second', 'Year_sdg4_second', 'impute_sdg4_second', 'Score_sdg4_second', 'Rating_sdg4_second', 'Trend_sdg4_second', 'Value_sdg4_literacy', 'Year_sdg4_literacy', 'Score_sdg4_literacy', 'Rating_sdg4_literacy', 'Trend_sdg4_literacy', 'Value_sdg4_tertiary', 'Year_sdg4_tertiary', 'Rating_sdg4_tertiary', 'Trend_sdg4_tertiary', 'Value_sdg4_pisa', 'Year_sdg4_pisa', 'Rating_sdg4_pisa', 'Trend_sdg4_pisa', 'Value_sdg4_socioec', 'Year_sdg4_socioec', 'Rating_sdg4_socioec', 'Trend_sdg4_socioec', 'Value_sdg4_science', 'Year_sdg4_science', 'Rating_sdg4_science', ], 5:[ 'Goal_5_Rating', 'Goal_5_Trend', 'Value_sdg5_rratio', 'Year_sdg5_rratio', 'Score_sdg5_rratio', 'Rating_sdg5_rratio', 'Trend_sdg5_rratio', 'Value_sdg5_vawage', 'Year_sdg5_vawage', 'Score_sdg5_vawage', 'Rating_sdg5_vawage', 'Trend_sdg5_vawage', 'Value_sdg5_lfpart', 'Year_sdg5_lfpart', 'Score_sdg5_lfpart', 'Rating_sdg5_lfpart', 'Trend_sdg5_lfpart', 'Value_sdg5_parl', 'Year_sdg5_parl', 'Score_sdg5_parl', 'Rating_sdg5_parl', 'Trend_sdg5_parl', 'Value_sdg5_fgm', 'Year_sdg5_fgm', 'Score_sdg5_fgm', 'Rating_sdg5_fgm', 'Trend_sdg5_fgm', 'Value_sdg5_cmarry', 'Year_sdg5_cmarry', 'Score_sdg5_cmarry', 'Rating_sdg5_cmarry', 'Trend_sdg5_cmarry', 'Value_sdg5_vabirth', 'Year_sdg5_vabirth', 'Score_sdg5_vabirth', 'Rating_sdg5_vabirth', 'Trend_sdg5_vabirth', ], 6:[ 'Goal_6_Rating', 'Goal_6_Trend', 'Value_sdg6_safewater', 'Year_sdg6_safewater', 'Score_sdg6_safewater', 'Rating_sdg6_safewater', 'Trend_sdg6_safewater', 'Value_sdg6_sanitation', 'Year_sdg6_sanitation', 'Score_sdg6_sanitation', 'Rating_sdg6_sanitation', 'Trend_sdg6_sanitation', 'Value_sdg6_freshwater', 'Year_sdg6_freshwater', 'Score_sdg6_freshwater', 'Rating_sdg6_freshwater', 'Trend_sdg6_freshwater', 'Value_sdg6_ecosystems', 'Year_sdg6_ecosystems', 'Score_sdg6_ecosystems', 'Rating_sdg6_ecosystems', 'Trend_sdg6_ecosystems', 'Value_sdg6_wateruse', 'Year_sdg6_wateruse', 'Score_sdg6_wateruse', 'Rating_sdg6_wateruse', 'Trend_sdg6_wateruse', 'Value_sdg6_waterstress', 'Year_sdg6_waterstress', 'Score_sdg6_waterstress', 'Rating_sdg6_waterstress', 'Trend_sdg6_waterstress', 'Value_sdg6_quality', 'Year_sdg6_quality', 'Score_sdg6_quality', 'Rating_sdg6_quality', 'Trend_sdg6_quality', 'Value_sdg6_wastewater', 'Year_sdg6_wastewater', 'Score_sdg6_wastewater', 'Rating_sdg6_wastewater', 'Trend_sdg6_wastewater', 'Value_sdg6_river', 'Year_sdg6_river', 'Score_sdg6_river', 'Rating_sdg6_river', 'Trend_sdg6_river', 'Value_sdg6_fisheries', 'Year_sdg6_fisheries', 'Score_sdg6_fisheries', 'Rating_sdg6_fisheries', 'Trend_sdg6_fisheries', ], 7:[ 'Goal_7_Rating', 'Goal_7_Trend', 'Value_sdg7_access', 'Year_sdg7_access', 'Score_sdg7_access', 'Rating_sdg7_access', 'Trend_sdg7_access', 'Value_sdg7_electrify', 'Year_sdg7_electrify', 'Score_sdg7_electrify', 'Rating_sdg7_electrify', 'Trend_sdg7_electrify', 'Value_sdg7_renewcon', 'Year_sdg7_renewcon', 'Score_sdg7_renewcon', 'Rating_sdg7_renewcon', 'Trend_sdg7_renewcon', 'Value_sdg7_afford', 'Year_sdg7_afford', 'Score_sdg7_afford', 'Rating_sdg7_afford', 'Trend_sdg7_afford', 'Value_sdg7_cleancook', 'Year_sdg7_cleancook', 'Score_sdg7_cleancook', 'Rating_sdg7_cleancook', 'Trend_sdg7_cleancook', 'Value_sdg7_nonrenewcon', 'Year_sdg7_nonrenewcon', 'Score_sdg7_nonrenewcon', 'Rating_sdg7_nonrenewcon', 'Trend_sdg7_nonrenewcon', 'Value_sdg7_biofuel', 'Year_sdg7_biofuel', 'Score_sdg7_biofuel', 'Rating_sdg7_biofuel', 'Trend_sdg7_biofuel', ], 8:[ 'Goal_8_Rating', 'Goal_8_Trend', 'Value_sdg8_adjgrowth', 'Year_sdg8_adjgrowth', 'Score_sdg8_adjgrowth', 'Rating_sdg8_adjgrowth', 'Value_sdg8_slavery', 'Year_sdg8_slavery', 'impute_sdg8_slavery', 'Score_sdg8_slavery', 'Rating_sdg8_slavery', 'Value_sdg8_accounts', 'Year_sdg8_accounts', 'Score_sdg8_accounts', 'Rating_sdg8_accounts', 'Trend_sdg8_accounts', 'Value_sdg8_unemp', 'Year_sdg8_unemp', 'Score_sdg8_unemp', 'Rating_sdg8_unemp', 'Trend_sdg8_unemp', ], 9:[ 'Goal_9_Rating', 'Goal_9_Trend', 'Value_sdg9_roads', 'Year_sdg9_roads', 'Score_sdg9_roads', 'Rating_sdg9_roads', 'Value_sdg9_intuse', 'Year_sdg9_intuse', 'Score_sdg9_intuse', 'Rating_sdg9_intuse', 'Trend_sdg9_intuse', 'Value_sdg9_mobuse', 'Year_sdg9_mobuse', 'Score_sdg9_mobuse', 'Rating_sdg9_mobuse', 'Trend_sdg9_mobuse', 'Value_sdg9_lpi', 'Year_sdg9_lpi', 'Score_sdg9_lpi', 'Rating_sdg9_lpi', 'Trend_sdg9_lpi', 'Value_sdg9_uni', 'Year_sdg9_uni', 'impute_sdg9_uni', 'Score_sdg9_uni', 'Rating_sdg9_uni', 'Value_sdg9_articles', 'Year_sdg9_articles', 'Score_sdg9_articles', 'Rating_sdg9_articles', 'Trend_sdg9_articles', 'Value_sdg9_rdex', 'Year_sdg9_rdex', 'impute_sdg9_rdex', 'Score_sdg9_rdex', 'Rating_sdg9_rdex', 'Trend_sdg9_rdex', 'Value_sdg9_rdres', 'Year_sdg9_rdres', 'Rating_sdg9_rdres', 'Trend_sdg9_rdres', 'Value_sdg9_patents', 'Year_sdg9_patents', 'Rating_sdg9_patents', 'Trend_sdg9_patents', 'Value_sdg9_netacc', 'Year_sdg9_netacc', 'Rating_sdg9_netacc', 'Trend_sdg9_netacc', 'Value_sdg9_womensci', 'Year_sdg9_womensci', 'Rating_sdg9_womensci', 'Trend_sdg9_womensci', ], 10:[ 'Goal_10_Rating', 'Goal_10_Trend', 'Value_sdg10_gini', 'Year_sdg10_gini', 'Score_sdg10_gini', 'Rating_sdg10_gini', 'Trend_sdg10_gini', 'Value_sdg10_palma', 'Year_sdg10_palma', 'Score_sdg10_palma', 'Rating_sdg10_palma', 'Trend_sdg10_palma', 'Value_sdg10_elder', 'Year_sdg10_elder', 'Rating_sdg10_elder', 'Trend_sdg10_elder', ], 11:[ 'Goal_11_Rating', 'Goal_11_Trend', 'Value_sdg11_slums', 'Year_sdg11_slums', 'impute_sdg11_slums', 'Score_sdg11_slums', 'Rating_sdg11_slums', 'Trend_sdg11_slums', 'Value_sdg11_pm25', 'Year_sdg11_pm25', 'Score_sdg11_pm25', 'Rating_sdg11_pm25', 'Trend_sdg11_pm25', 'Value_sdg11_pipedwat', 'Year_sdg11_pipedwat', 'Score_sdg11_pipedwat', 'Rating_sdg11_pipedwat', 'Trend_sdg11_pipedwat', 'Value_sdg11_transport', 'Year_sdg11_transport', 'Score_sdg11_transport', 'Rating_sdg11_transport', 'Trend_sdg11_transport', 'Value_sdg11_rentover', 'Year_sdg11_rentover', 'Rating_sdg11_rentover', 'Trend_sdg11_rentover', 'Value_sdg11_walkable', 'Year_sdg11_walkable', 'Rating_sdg11_walkable', ], 12:[ 'Goal_12_Rating', 'Goal_12_Trend', 'Value_sdg12_waste', 'Year_sdg12_waste', 'impute_sdg12_waste', 'Score_sdg12_waste', 'Rating_sdg12_waste', 'Trend_sdg12_waste', 'Value_sdg12_recycling', 'Year_sdg12_recycling', 'impute_sdg12_recycling', 'Score_sdg12_recycling', 'Rating_sdg12_recycling', 'Trend_sdg12_recycling', 'Value_sdg12_solidwaste', 'Year_sdg12_solidwaste', 'impute_sdg12_solidwaste', 'Score_sdg12_solidwaste', 'Rating_sdg12_solidwaste', 'Trend_sdg12_solidwaste', ], 13:[ 'Goal_13_Rating', 'Goal_13_Trend', 'Value_sdg13_emissions', 'Year_sdg13_emissions', 'impute_sdg13_emissions', 'Score_sdg13_emissions', 'Rating_sdg13_emissions', 'Trend_sdg13_emissions', 'Value_sdg13_forests', 'Year_sdg13_forests', 'impute_sdg13_forests', 'Score_sdg13_forests', 'Rating_sdg13_forests', 'Trend_sdg13_forests', ], 14:[ 'Goal_14_Rating', 'Goal_14_Trend', 'Value_sdg14_overfishing', 'Year_sdg14_overfishing', 'impute_sdg14_overfishing', 'Score_sdg14_overfishing', 'Rating_sdg14_overfishing', 'Trend_sdg14_overfishing', 'Value_sdg14_mpa', 'Year_sdg14_mpa', 'impute_sdg14_mpa', 'Score_sdg14_mpa', 'Rating_sdg14_mpa', 'Trend_sdg14_mpa', ], 17:[ 'Goal_17_Rating', 'Goal_17_Trend', 'Value_sdg17_govex', 'Year_sdg17_govex', 'Score_sdg17_govex', 'Rating_sdg17_govex', 'Trend_sdg17_govex', 'Value_sdg17_oda', 'Year_sdg17_oda', 'Score_sdg17_oda', 'Rating_sdg17_oda', 'Trend_sdg17_oda', 'Value_sdg17_fp', 'Year_sdg17_fp', 'impute_sdg17_fp', 'Score_sdg17_fp', 'Rating_sdg17_fp', 'Trend_sdg17_fp', ] } def filter_data(country_name, sdg_number): # Load your dataset data = pd.read_csv(r'C:\Users\Samer\OneDrive\DS\SDG\new\Sustainable_Development_Report_2023_(with_indicators)__-2086263501583264136.csv') # Create a mapping of SDG numbers to their corresponding columns sdg_column_mapping = { 0:[ 'Goal_Rating', 'Goal_Trend', 'Value_sdg_earlyedu', 'Year_sdg_earlyedu', 'impute_sdg_earlyedu', 'Score_sdg_earlyedu', 'Rating_sdg_earlyedu', 'Trend_sdg_earlyedu', 'Value_sdg_primary', 'Year_sdg_primary', 'Score_sdg_primary', 'Rating_sdg_primary', 'Trend_sdg_primary', 'Value_sdg_second', 'Year_sdg_second', 'impute_sdg_second', 'Score_sdg_second', 'Rating_sdg_second', 'Trend_sdg_second', 'Value_sdg_literacy', 'Year_sdg_literacy', 'Score_sdg_literacy', 'Rating_sdg_literacy', 'Trend_sdg_literacy', 'Value_sdg_tertiary', 'Year_sdg_tertiary', 'Score_sdg_tertiary', 'Rating_sdg_tertiary', 'Trend_sdg_tertiary', 'Value_sdg_pisa', 'Year_sdg_pisa', 'Rating_sdg_pisa', 'Trend_sdg_pisa', 'Value_sdg_socioec', 'Year_sdg_socioec', 'Rating_sdg_socioec', 'Trend_sdg_socioec', 'Value_sdg_science', 'Year_sdg_science', 'Rating_sdg_science', 'Trend_sdg_science',], 3:[ 'Goal_3_Rating', 'Goal_3_Trend', 'Value_sdg3_matmort', 'Year_sdg3_matmort', 'Score_sdg3_matmort', 'Rating_sdg3_matmort', 'Trend_sdg3_matmort', 'Value_sdg3_neonat', 'Year_sdg3_neonat', 'Score_sdg3_neonat', 'Rating_sdg3_neonat', 'Trend_sdg3_neonat', 'Value_sdg3_u5mort', 'Year_sdg3_u5mort', 'Score_sdg3_u5mort', 'Rating_sdg3_u5mort', 'Trend_sdg3_u5mort', 'Value_sdg3_tb', 'Year_sdg3_tb', 'Score_sdg3_tb', 'Rating_sdg3_tb', 'Trend_sdg3_tb', 'Value_sdg3_hiv', 'Year_sdg3_hiv', 'Score_sdg3_hiv', 'Rating_sdg3_hiv', 'Trend_sdg3_hiv', 'Value_sdg3_ncds', 'Year_sdg3_ncds', 'Score_sdg3_ncds', 'Rating_sdg3_ncds', 'Trend_sdg3_ncds', 'Value_sdg3_pollmort', 'Year_sdg3_pollmort', 'Score_sdg3_pollmort', 'Rating_sdg3_pollmort', 'Value_sdg3_traffic', 'Year_sdg3_traffic', 'Score_sdg3_traffic', 'Rating_sdg3_traffic', 'Trend_sdg3_traffic', 'Value_sdg3_lifee', 'Year_sdg3_lifee', 'Score_sdg3_lifee', 'Rating_sdg3_lifee', 'Trend_sdg3_lifee', 'Value_sdg3_fertility', 'Year_sdg3_fertility', 'Score_sdg3_fertility', 'Rating_sdg3_fertility', 'Trend_sdg3_fertility', 'Value_sdg3_births', 'Year_sdg3_births', 'Score_sdg3_births', 'Rating_sdg3_births', 'Trend_sdg3_births', 'Value_sdg3_vac', 'Year_sdg3_vac', 'Score_sdg3_vac', 'Rating_sdg3_vac', 'Trend_sdg3_vac', 'Value_sdg3_uhc', 'Year_sdg3_uhc', 'Score_sdg3_uhc', 'Rating_sdg3_uhc', 'Trend_sdg3_uhc', 'Value_sdg3_swb', 'Year_sdg3_swb', 'Score_sdg3_swb', 'Rating_sdg3_swb', 'Trend_sdg3_swb', 'Value_sdg3_region', 'Year_sdg3_region', 'Rating_sdg3_region', 'Trend_sdg3_region', 'Value_sdg3_incomeg', 'Year_sdg3_incomeg', 'Rating_sdg3_incomeg', 'Trend_sdg3_incomeg', 'Value_sdg3_smoke', 'Year_sdg3_smoke', 'Rating_sdg3_smoke', 'Trend_sdg3_smoke', ], 4: [ 'Goal_4_Rating', 'Goal_4_Trend', 'Value_sdg4_earlyedu', 'Year_sdg4_earlyedu', 'Score_sdg4_earlyedu', 'Rating_sdg4_earlyedu', 'Value_sdg4_primary', 'Year_sdg4_primary', 'Score_sdg4_primary', 'Rating_sdg4_primary', 'Trend_sdg4_primary', 'Value_sdg4_second', 'Year_sdg4_second', 'impute_sdg4_second', 'Score_sdg4_second', 'Rating_sdg4_second', 'Trend_sdg4_second', 'Value_sdg4_literacy', 'Year_sdg4_literacy', 'Score_sdg4_literacy', 'Rating_sdg4_literacy', 'Trend_sdg4_literacy', 'Value_sdg4_tertiary', 'Year_sdg4_tertiary', 'Rating_sdg4_tertiary', 'Trend_sdg4_tertiary', 'Value_sdg4_pisa', 'Year_sdg4_pisa', 'Rating_sdg4_pisa', 'Trend_sdg4_pisa', 'Value_sdg4_socioec', 'Year_sdg4_socioec', 'Rating_sdg4_socioec', 'Trend_sdg4_socioec', 'Value_sdg4_science', 'Year_sdg4_science', 'Rating_sdg4_science', ], 5:[ 'Goal_5_Rating', 'Goal_5_Trend', 'Value_sdg5_rratio', 'Year_sdg5_rratio', 'Score_sdg5_rratio', 'Rating_sdg5_rratio', 'Trend_sdg5_rratio', 'Value_sdg5_vawage', 'Year_sdg5_vawage', 'Score_sdg5_vawage', 'Rating_sdg5_vawage', 'Trend_sdg5_vawage', 'Value_sdg5_lfpart', 'Year_sdg5_lfpart', 'Score_sdg5_lfpart', 'Rating_sdg5_lfpart', 'Trend_sdg5_lfpart', 'Value_sdg5_parl', 'Year_sdg5_parl', 'Score_sdg5_parl', 'Rating_sdg5_parl', 'Trend_sdg5_parl', 'Value_sdg5_fgm', 'Year_sdg5_fgm', 'Score_sdg5_fgm', 'Rating_sdg5_fgm', 'Trend_sdg5_fgm', 'Value_sdg5_cmarry', 'Year_sdg5_cmarry', 'Score_sdg5_cmarry', 'Rating_sdg5_cmarry', 'Trend_sdg5_cmarry', 'Value_sdg5_vabirth', 'Year_sdg5_vabirth', 'Score_sdg5_vabirth', 'Rating_sdg5_vabirth', 'Trend_sdg5_vabirth', ], 6:[ 'Goal_6_Rating', 'Goal_6_Trend', 'Value_sdg6_safewater', 'Year_sdg6_safewater', 'Score_sdg6_safewater', 'Rating_sdg6_safewater', 'Trend_sdg6_safewater', 'Value_sdg6_sanitation', 'Year_sdg6_sanitation', 'Score_sdg6_sanitation', 'Rating_sdg6_sanitation', 'Trend_sdg6_sanitation', 'Value_sdg6_freshwater', 'Year_sdg6_freshwater', 'Score_sdg6_freshwater', 'Rating_sdg6_freshwater', 'Trend_sdg6_freshwater', 'Value_sdg6_ecosystems', 'Year_sdg6_ecosystems', 'Score_sdg6_ecosystems', 'Rating_sdg6_ecosystems', 'Trend_sdg6_ecosystems', 'Value_sdg6_wateruse', 'Year_sdg6_wateruse', 'Score_sdg6_wateruse', 'Rating_sdg6_wateruse', 'Trend_sdg6_wateruse', 'Value_sdg6_waterstress', 'Year_sdg6_waterstress', 'Score_sdg6_waterstress', 'Rating_sdg6_waterstress', 'Trend_sdg6_waterstress', 'Value_sdg6_quality', 'Year_sdg6_quality', 'Score_sdg6_quality', 'Rating_sdg6_quality', 'Trend_sdg6_quality', 'Value_sdg6_wastewater', 'Year_sdg6_wastewater', 'Score_sdg6_wastewater', 'Rating_sdg6_wastewater', 'Trend_sdg6_wastewater', 'Value_sdg6_river', 'Year_sdg6_river', 'Score_sdg6_river', 'Rating_sdg6_river', 'Trend_sdg6_river', 'Value_sdg6_fisheries', 'Year_sdg6_fisheries', 'Score_sdg6_fisheries', 'Rating_sdg6_fisheries', 'Trend_sdg6_fisheries', ], 7:[ 'Goal_7_Rating', 'Goal_7_Trend', 'Value_sdg7_access', 'Year_sdg7_access', 'Score_sdg7_access', 'Rating_sdg7_access', 'Trend_sdg7_access', 'Value_sdg7_electrify', 'Year_sdg7_electrify', 'Score_sdg7_electrify', 'Rating_sdg7_electrify', 'Trend_sdg7_electrify', 'Value_sdg7_renewcon', 'Year_sdg7_renewcon', 'Score_sdg7_renewcon', 'Rating_sdg7_renewcon', 'Trend_sdg7_renewcon', 'Value_sdg7_afford', 'Year_sdg7_afford', 'Score_sdg7_afford', 'Rating_sdg7_afford', 'Trend_sdg7_afford', 'Value_sdg7_cleancook', 'Year_sdg7_cleancook', 'Score_sdg7_cleancook', 'Rating_sdg7_cleancook', 'Trend_sdg7_cleancook', 'Value_sdg7_nonrenewcon', 'Year_sdg7_nonrenewcon', 'Score_sdg7_nonrenewcon', 'Rating_sdg7_nonrenewcon', 'Trend_sdg7_nonrenewcon', 'Value_sdg7_biofuel', 'Year_sdg7_biofuel', 'Score_sdg7_biofuel', 'Rating_sdg7_biofuel', 'Trend_sdg7_biofuel', ], 8:[ 'Goal_8_Rating', 'Goal_8_Trend', 'Value_sdg8_adjgrowth', 'Year_sdg8_adjgrowth', 'Score_sdg8_adjgrowth', 'Rating_sdg8_adjgrowth', 'Value_sdg8_slavery', 'Year_sdg8_slavery', 'impute_sdg8_slavery', 'Score_sdg8_slavery', 'Rating_sdg8_slavery', 'Value_sdg8_accounts', 'Year_sdg8_accounts', 'Score_sdg8_accounts', 'Rating_sdg8_accounts', 'Trend_sdg8_accounts', 'Value_sdg8_unemp', 'Year_sdg8_unemp', 'Score_sdg8_unemp', 'Rating_sdg8_unemp', 'Trend_sdg8_unemp', ], 9:[ 'Goal_9_Rating', 'Goal_9_Trend', 'Value_sdg9_roads', 'Year_sdg9_roads', 'Score_sdg9_roads', 'Rating_sdg9_roads', 'Value_sdg9_intuse', 'Year_sdg9_intuse', 'Score_sdg9_intuse', 'Rating_sdg9_intuse', 'Trend_sdg9_intuse', 'Value_sdg9_mobuse', 'Year_sdg9_mobuse', 'Score_sdg9_mobuse', 'Rating_sdg9_mobuse', 'Trend_sdg9_mobuse', 'Value_sdg9_lpi', 'Year_sdg9_lpi', 'Score_sdg9_lpi', 'Rating_sdg9_lpi', 'Trend_sdg9_lpi', 'Value_sdg9_uni', 'Year_sdg9_uni', 'impute_sdg9_uni', 'Score_sdg9_uni', 'Rating_sdg9_uni', 'Value_sdg9_articles', 'Year_sdg9_articles', 'Score_sdg9_articles', 'Rating_sdg9_articles', 'Trend_sdg9_articles', 'Value_sdg9_rdex', 'Year_sdg9_rdex', 'impute_sdg9_rdex', 'Score_sdg9_rdex', 'Rating_sdg9_rdex', 'Trend_sdg9_rdex', 'Value_sdg9_rdres', 'Year_sdg9_rdres', 'Rating_sdg9_rdres', 'Trend_sdg9_rdres', 'Value_sdg9_patents', 'Year_sdg9_patents', 'Rating_sdg9_patents', 'Trend_sdg9_patents', 'Value_sdg9_netacc', 'Year_sdg9_netacc', 'Rating_sdg9_netacc', 'Trend_sdg9_netacc', 'Value_sdg9_womensci', 'Year_sdg9_womensci', 'Rating_sdg9_womensci', 'Trend_sdg9_womensci', ], 10:[ 'Goal_10_Rating', 'Goal_10_Trend', 'Value_sdg10_gini', 'Year_sdg10_gini', 'Score_sdg10_gini', 'Rating_sdg10_gini', 'Trend_sdg10_gini', 'Value_sdg10_palma', 'Year_sdg10_palma', 'Score_sdg10_palma', 'Rating_sdg10_palma', 'Trend_sdg10_palma', 'Value_sdg10_elder', 'Year_sdg10_elder', 'Rating_sdg10_elder', 'Trend_sdg10_elder', ], 11:[ 'Goal_11_Rating', 'Goal_11_Trend', 'Value_sdg11_slums', 'Year_sdg11_slums', 'impute_sdg11_slums', 'Score_sdg11_slums', 'Rating_sdg11_slums', 'Trend_sdg11_slums', 'Value_sdg11_pm25', 'Year_sdg11_pm25', 'Score_sdg11_pm25', 'Rating_sdg11_pm25', 'Trend_sdg11_pm25', 'Value_sdg11_pipedwat', 'Year_sdg11_pipedwat', 'Score_sdg11_pipedwat', 'Rating_sdg11_pipedwat', 'Trend_sdg11_pipedwat', 'Value_sdg11_transport', 'Year_sdg11_transport', 'Score_sdg11_transport', 'Rating_sdg11_transport', 'Trend_sdg11_transport', 'Value_sdg11_rentover', 'Year_sdg11_rentover', 'Rating_sdg11_rentover', 'Trend_sdg11_rentover', 'Value_sdg11_walkable', 'Year_sdg11_walkable', 'Rating_sdg11_walkable', ], 12:[ 'Goal_12_Rating', 'Goal_12_Trend', 'Value_sdg12_waste', 'Year_sdg12_waste', 'impute_sdg12_waste', 'Score_sdg12_waste', 'Rating_sdg12_waste', 'Trend_sdg12_waste', 'Value_sdg12_recycling', 'Year_sdg12_recycling', 'impute_sdg12_recycling', 'Score_sdg12_recycling', 'Rating_sdg12_recycling', 'Trend_sdg12_recycling', 'Value_sdg12_solidwaste', 'Year_sdg12_solidwaste', 'impute_sdg12_solidwaste', 'Score_sdg12_solidwaste', 'Rating_sdg12_solidwaste', 'Trend_sdg12_solidwaste', ], 13:[ 'Goal_13_Rating', 'Goal_13_Trend', 'Value_sdg13_emissions', 'Year_sdg13_emissions', 'impute_sdg13_emissions', 'Score_sdg13_emissions', 'Rating_sdg13_emissions', 'Trend_sdg13_emissions', 'Value_sdg13_forests', 'Year_sdg13_forests', 'impute_sdg13_forests', 'Score_sdg13_forests', 'Rating_sdg13_forests', 'Trend_sdg13_forests', ], 14:[ 'Goal_14_Rating', 'Goal_14_Trend', 'Value_sdg14_overfishing', 'Year_sdg14_overfishing', 'impute_sdg14_overfishing', 'Score_sdg14_overfishing', 'Rating_sdg14_overfishing', 'Trend_sdg14_overfishing', 'Value_sdg14_mpa', 'Year_sdg14_mpa', 'impute_sdg14_mpa', 'Score_sdg14_mpa', 'Rating_sdg14_mpa', 'Trend_sdg14_mpa', ], 17:[ 'Goal_17_Rating', 'Goal_17_Trend', 'Value_sdg17_govex', 'Year_sdg17_govex', 'Score_sdg17_govex', 'Rating_sdg17_govex', 'Trend_sdg17_govex', 'Value_sdg17_oda', 'Year_sdg17_oda', 'Score_sdg17_oda', 'Rating_sdg17_oda', 'Trend_sdg17_oda', 'Value_sdg17_fp', 'Year_sdg17_fp', 'impute_sdg17_fp', 'Score_sdg17_fp', 'Rating_sdg17_fp', 'Trend_sdg17_fp', ] } # Get the list of columns based on the selected SDG number selected_columns = ['Country_Name'] + sdg_column_mapping.get(sdg_number, []) # Filter data based on country and selected columns selected_data = data[data['Name'] == country_name][selected_columns] return selected_data