Nov-12-2020, 09:58 AM
use the csv modul to read the file
and max to find the highest value (replace /path/to/file.csv with your path)
and max to find the highest value (replace /path/to/file.csv with your path)
import csv # Columns: Fra;Til;KWH 60 Forbruk scores_list = [] def findValue(): with open("/path/to/file.csv") as csvfile: reader = csv.DictReader(csvfile, delimiter = ";") # replace comma with point and find highest float in KWH 60 Forbruk maxnum = max(reader, key=lambda row: float(row["KWH 60 Forbruk"].replace(",", "."))) print(maxnum) findValue()
Output:{'Fra': '20.07.2019 21:00', 'Til': '20.07.2019 22:00', 'KWH 60 Forbruk': '6,554'}