Vedant-acharya's picture
Added 3 category files area,funding and population
1b058a8 verified
def true_code():
import numpy as np
import pandas as pd
main_data = pd.read_csv("raw_data/main_data.csv")
main_data['Timestamp'] = pd.to_datetime(main_data['Timestamp'])
states_data = pd.read_csv("raw_data/State_data.csv")
ncap_funding_data = pd.read_csv("raw_data/NCAP_Funding.csv")
ncap_funding_data.replace('-', np.nan, inplace=True)
ncap_funding_data['Amount released during FY 2019-20'] = ncap_funding_data['Amount released during FY 2019-20'].astype('float64')
ncap_funding_data['Amount released during FY 2020-21'] = ncap_funding_data['Amount released during FY 2020-21'].astype('float64')
ncap_funding_data['Amount released during FY 2021-22'] = ncap_funding_data['Amount released during FY 2021-22'].astype('float64')
ncap_funding_data['Utilisation as on June 2022'] = ncap_funding_data['Utilisation as on June 2022'].astype('float64')
state_pm25_avg = main_data.groupby('state')['PM2.5'].mean().reset_index()
state_pm25_avg = state_pm25_avg.sort_values('PM2.5', ascending=False)
top_3_states = state_pm25_avg.head(3)['state'].tolist()
top_3_states_data = states_data[states_data['state'].isin(top_3_states)]
most_populated_state = top_3_states_data.loc[top_3_states_data['population'].idxmax()]['state']
print(most_populated_state)
true_code()