Here is a dataframe.
df = pd.DataFrame({'GDP per Capita(nominal)' : [180366.7, 116935.6004,104861.8511,94277.96536,85535.3832,71809.25058,67335.29341,64800.05733,57410.16586,48472.54454,46949.28309],
'Deaths to Cases(%)' : [1.738361815,0.2561113616,0,1.07778077,0.07438664827,0.2628120894,1.36447959,0.4580663137,1.344920688,0.9312013661,1.285648031]})
IN [1] : print(df)
OUT [1] :
GDP per Capita(nominal) Deaths to Cases(%)
0 180366.70000 1.738362
1 116935.60040 0.256111
2 104861.85110 0.000000
3 94277.96536 1.077781
4 85535.38320 0.074387
5 71809.25058 0.262812
6 67335.29341 1.364480
7 64800.05733 0.458066
8 57410.16586 1.344921
9 48472.54454 0.931201
10 46949.28309 1.285648
Assume the dataframe is a csv file.
How would I, using pandas, append the corresponding values from the 'GDP per Capita' column to a list, if the 'Deaths to Cases' value was greater than 0.5
For example, the expected output for the snippet would be:
ListA = [180366.7, 94277.96536, 67335.29341, 57410.16586, 48472.54454, 46949.28309]
Thanks in advance