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()])
6 odpowiedzi
+ 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.
+ 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
^
+ 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])
0
I have tried but nothing changed 😕
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])
0
But there is a mistake again with this one