W
W
Web__Nikita032019-07-18 08:04:39
Python
Web__Nikita03, 2019-07-18 08:04:39

How to get max value from csv?

I am using pandas.
Here is part of the csv file: https://pastebin.com/UMbk8WRG
I found this way

df = pd.read_csv("путь к файлу")
def max_min_index(name_of_index):
    max_value = df[name_of_index].idxmax()
    return max_value

max_min_freedomhouse_score = max_min_index('freedomhouse_score')

But the function returns 44, although even from the part of the file that I attached, it can be seen that this is not the case
And how to return the country and the maximum value, and not just the maximum value

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Statkevich, 2019-07-18
@Web__Nikita03

https://www.geeksforgeeks.org/select-row-with-maxi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question