Apr-14-2021, 02:52 PM
(This post was last modified: Apr-14-2021, 02:52 PM by stylingpat.)
Hello everyone!
I have a dataframe with 2 columns (A,B) and 3 rows.
A B
1 X
2 Y
3 Z
I am using this code right now
How would I make it so, when it assigns the highest value to "variable", that is only checks for X in column B instead of checking every row?
So I would like the code to instead assign 1 to variable, since the highest number for X is 1
Any ideas?
I have a dataframe with 2 columns (A,B) and 3 rows.
A B
1 X
2 Y
3 Z
I am using this code right now
variable = df["A"].sort_values(ascending=True).values[-1]To assign the current highest value of A to my variable.
How would I make it so, when it assigns the highest value to "variable", that is only checks for X in column B instead of checking every row?
So I would like the code to instead assign 1 to variable, since the highest number for X is 1
Any ideas?