

# https://www.globalsino.com/ICs/page4853.html
# Find the maximum in a column in a csv file


import csv

with open(r'C:\GlobalSino\ICs\ExampleFiledUsedINtestingPython\Values_to.csv') as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=',')
    row_count = 0
    id_max = 0

    # Input an number which is for sure smaller than all the numbers in the examing list
    value_max = -100

    for row in csv_reader:
        if row_count == 0:
            # print(f'Column names are {",".join(row)}')
            row_count +=1
        else:
            # print(f'ID is {row[0]} and the value is {row[1]}')
            row_count +=1
            if float(row[1]) > value_max:
                id_max, value_max = row[0], float(row[1])

print(f'ID_at_max: {id_max} and max value: {value_max}')

