-1
data1 = pd.read_csv("current-data-on-the-geographic-distribution-of-covid-19-cases-worldwide.csv")
data1.head()

The output:

daterep day month   year    cases   deaths  countriesandterritories geoid   countryterritorycode    popdata2018 continentexp
0   NaN 28  4   2020    172 0   Afghanistan AF  AFG 37172386.0  Asia
1   NaN 27  4   2020    68  10  Afghanistan AF  AFG 37172386.0  Asia
2   NaN 26  4   2020    112 4   Afghanistan AF  AFG 37172386.0  Asia
3   NaN 25  4   2020    70  1   Afghanistan AF  AFG 37172386.0  Asia
4   NaN 24  4   2020    105 2   Afghanistan AF  AFG 37172386.0  Asia

I want to add this data a rate variable that shows deaths/cases.I tried the tranform() but it did not work, how can I make this?

buran
  • 13,682
  • 10
  • 36
  • 61
nur
  • 1

1 Answers1

0

If I understand correctly this works

data1['death_rate'] = data1['deaths'] / data1['cases']
Tyler
  • 75
  • 5