+ 1
plz help me to solve the covid data analysis project in python for data science
7 odpowiedzi
+ 4
ok u add ratio. Now u need filter dates with max ratio for this u can use simple equal df["ratio"]==df["ratio"].max()
put this equal in df[here] and u got dates with max ratio
https://code.sololearn.com/co287aYKt37I/?ref=app
+ 2
I know what this task is. I want to know what your problem is. you want to get a solution or you want to get knowledge of how to solve.
0
Hmm, where your try or problem question?
0
In sololearn python for data science course data manipulation with pandas chapter project
0
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']
maxindx=df['ratio'].idxmax()
print(df.iloc[maxindx])
i tried like this.. its not getting perfect
0
I got it.. thnk u so much 😊
0
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"]
max_ratio = df.loc[df["ratio"]==df["ratio"].max()]
print(max_ratio)