How can I output a row of DataFram in python , numpy array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I output a row of DataFram in python , numpy array?

Hello, In the following code, 'Covid' dataset has two columns named cases and deaths. I must create a new column named ratio which is deaths/cases. Then I must represent the row related to date which its ratio element was maximum. I have the problem with the last section. I can not do that. Can anyone help me? Thank you. https://code.sololearn.com/c3G5qnn6JX84/?ref=app

28th Aug 2022, 3:44 PM
Mohammad Reza Moravejolahkami
Mohammad Reza Moravejolahkami - avatar
1 Answer
+ 1
df['ratio'].max() returns the maximum. Now you can index the row by selecting the row where the ratio equals the maximum
29th Aug 2022, 11:36 AM
Lisa
Lisa - avatar