Two part json problem: Converting portions of list items to float, pulling max value from specific index in each list

21 views Asked by At

I am working with a json list. To start for this specific issue I am not allowed to use pandas so I am working with a json list inside of a dictionary. I essentially have rows of data that correspond to column keys but they are not(and can't go into) a dataframe. My first problem is that python is interpreting the elements as strings. Next I need to be able to pull the max value for the second column(index 1) in the list. Below is the code for the json list and a small portion of the list of lists that I am working with.

   info= json_data['dataset_data']['data']
   print(info)

    [['2017-12-29', 51.76, 51.94, 51.45, 51.76, None, 34640.0, 1792304.0, None, None, None], ['2017-12-28', 51.65, 51.82, 51.43, 51.6, None, 40660.0, 2099024.0, None, None, None], ['2017-12-27', 51.45, 51.89, 50.76, 51.82, None, 57452.0, 2957018.0, None, None, None], ['2017-12-22', 51.05, 51.5, 50.92, 51.32, None, 71165.0, 3641949.0, None, None, None], ['2017-12-21', 51.16, 51.52, 50.9, 51.4, None, 120649.0, 6179433.0, None, None, None], ['2017-12-20', 51.88, 52.04, 51.2, 51.27, None, 50587.0, 2610258.0, None, None, None], ['2017-12-19', 52.73, 52.73, 51.07, 51.66, None, 137313.0, 7102361.0, None, None, None], ['2017-12-18', 52.37, 52.75, 51.61, 52.62, None, 129733.0, 6770499.0, None, None, None], ['2017-12-15', 52.7, 52.7, 51.64, 52.01, None, 204080.0, 10596319.0, None, None, None],

I need to change all items in the lists to floats minus the first item which is a date. I haven't been able to figure out how to do this for the specific subset of items within each list. How do I get the code to iterate of over the list of lists and find the max value in a specific index? The index represents a specific column that I need the max value of?

0

There are 0 answers