+ 2

can you plz help me to solve this

You are working with the COVID dataset for California, which includes the number of cases and deaths for each day of 2020. Find the day when the deaths/cases ratio was largest.

16th Apr 2021, 4:17 AM
HEWAGAMAGE LAKSHITHA SHESHAN
HEWAGAMAGE LAKSHITHA SHESHAN - avatar
3 Respuestas
+ 1
Hi! For better help to you, please show us your code attempt!
16th Apr 2021, 5:03 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
import pandas as pd df = pd.read_csv("/usercode/files/ca-covid.csv") df.drop('state', axis=1, inplace=True) df.set_index('date', inplace=True) df['ratio']=df['deaths']/df['cases'] maxinx=df['ratio'].idxmax() print(df.iloc[maxinx]) i tried like this
16th Apr 2021, 5:10 AM
HEWAGAMAGE LAKSHITHA SHESHAN
HEWAGAMAGE LAKSHITHA SHESHAN - avatar
+ 1
this is the full questin You are working with the COVID dataset for California, which includes the number of cases and deaths for each day of 2020. Find the day when the deaths/cases ratio was largest. To do this, you need to first calculate the deaths/cases ratio and add it as a column to the DataFrame with the name 'ratio', then find the row that corresponds to the largest value. Important: The output should be a DataFrame, containing all of the columns of the dataset for the corresponding row.
16th Apr 2021, 5:12 AM
HEWAGAMAGE LAKSHITHA SHESHAN
HEWAGAMAGE LAKSHITHA SHESHAN - avatar