Covid data analysis | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Covid data analysis

Where is my mistake??? 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'] print(df[df['ratio'] == df['ratio'].max()])

30th Sep 2022, 5:53 PM
CĆ©dric De Craim
CĆ©dric De Craim - avatar
6 Respostas
+ 5
CĆ©dric De Craim , if the mentioned modifications are done properly (based on the code you posted initially), the code is running properly in this exercise. make sure you did no other modifications. if you still have trouble copy your last code version and link it here.
1st Oct 2022, 6:11 PM
Lothar
Lothar - avatar
+ 4
CĆ©dric De Craim , only a small issues: > there is a slash missing in the path name of the covid file between '...files/ca-covid.csv' > the final print statement has to be in a separate line ^
30th Sep 2022, 6:34 PM
Lothar
Lothar - avatar
+ 4
CĆ©dric De Craim , (1) remove the space in the file path: ... df = pd.read_csv("/usercode/files/ca-covid.csv") ^^^^ (2) your last line in code is not correct, since it contains 3 regular lines. break them down like this: ... df['ratio']=df['deaths']/df['cases'] maxratio=df['ratio'].max() print(df[ df['ratio']==maxratio])
4th Oct 2022, 1:52 PM
Lothar
Lothar - avatar
0
I have tried but nothing changed šŸ˜•
30th Sep 2022, 6:53 PM
CĆ©dric De Craim
CĆ©dric De Craim - avatar
0
I have changed the code 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'] maxratio=df['ratio'].max() print(df[ df['ratio']==maxratio])
3rd Oct 2022, 12:40 PM
CĆ©dric De Craim
CĆ©dric De Craim - avatar
0
But there is a mistake again with this one
3rd Oct 2022, 12:41 PM
CĆ©dric De Craim
CĆ©dric De Craim - avatar