0

Dataframes, pandas and computed columns - please point out the error

https://code.sololearn.com/cik50wY5muvZ/?ref=app

12th Oct 2022, 4:00 PM
Sanjay Kamath
Sanjay Kamath - avatar
1 Answer
+ 1
import pandas as pd data = pd.read_csv("/usercode/files/ca-covid.csv") df = pd.DataFrame(data) newdf= df.assign(ratio = df["deaths"]/df["cases"]) #Or: newdf = df.assign(ratio = df.deaths/df.cases) print(newdf)
12th Oct 2022, 7:49 PM
Solo
Solo - avatar