Am new to python and have a nested dictionary from a CSV that looks like this:
data = {
{object: a, type: 1, value: 1.50, another_value: 2}
{object: b, type: 1, value: 3.67, another_value: 4}
}
I am trying print data from different columns if a value exists. First, I want to find the max number in all entries in the 'value' column. Then I want to print the 'object' if that max value exists within that dictionary.
So in this instance I want my output to look like:
print('Max value is 3.67 which is found in object b)
I've managed this far:
data = {see above}
max_list[]
for row in data:
values = float(row['value'])
max_list.append(values)
max_value = max(max_list)
if max_value in data
max_object = data(['object'])
print('Max value: {} which is found in object {}'.format(max_value, max_object))
Any help would be appreciated! Thanks!
Aucun commentaire:
Enregistrer un commentaire