I am using a online dataset for global life expectancy and I am trying to find the max and min number in the life_expectancy column.
Here is the dataset: https://ourworldindata.org/spanish-flu-largest-influenza-pandemic-in-history
This is what I have after trying math equations and max() and min() as suggested in other posts.
with open('data/life-expectancy.csv') as life_expectancy:
next(life_expectancy)
for data in life_expectancy:
clean_data = data.strip()
split_data = clean_data.split(',')
entity = split_data[0]
code = split_data[1]
year = split_data[2]
expectancy = float(split_data[3])
print(f'The overall max life expectancy is: {max(split_data[3])}')
print(f'The overall min life expectancy is: {min(split_data[3])}')
What else should I add to actually get proper results?
Current Output:
The overall max life expectancy is: 9
The overall min life expectancy is: .