Issue
I have this CSV to read, but I need to filter the groupby values by column 'State' where 'Updated On' values is 24/04/2021, but I don't know how.
acoesEstado = pd.read_csv("https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv", index_col=0)
filtro = acoesEstado.groupby(['State']).sum(Updated On = '25/04/2021').reset_index()
filtro['Total Tested']
I want the output: select all States where Updated On = 24/04/2021
Solution
If you are looking for Sum of Total Tested by State for 24/04/2021.
df.loc['24/04/2021'].groupby('State')['Total Tested'].sum()
Considering Input:
df = pd.read_csv("https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv", index_col=0)
**Sample Output:
State
Andaman and Nicobar Islands 0.0
Andhra Pradesh 15931722.0
Arunachal Pradesh 434293.0
Assam 8240455.0
Bihar 25852574.0
Answered By - Utsav
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.