Reputation: 1739
I have a Pandas Series
which contains dictionaries holding two key-value pairs each.
Here is a picture of the data (apologies for size)
How would I go about getting all of the 'C'
key's values, like [10000000.0, 3162277.66 ..., 1000000.0, ...]
here? I've already tried sorted_combos.iloc[:, 0]['C']
, but that gives me a KeyError
, so I am stumped.
How am I do to this for future reference? Thank you all in advance.
Upvotes: 1
Views: 57
Reputation: 89
You can try using a list comprehension to loop over all the dictionaries. In this case, the code would be [dic['C'] for dic in sorted_combos.iloc[:,0]]
.
Upvotes: 1