Last active
May 29, 2020 14:40
-
-
Save hanjae-jea/0e72facfd4032ddd2ba5c9054b0567af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
price = { | |
'A006340': { | |
'daygap_list' : [0.025, 0.041, 0.037], | |
'geo_mean': 0.01 | |
}, | |
'A001324': { | |
'daygap_list': [0.01, 0.023, 0.012], | |
'geo_mean': 0.008 | |
} | |
} | |
li = [] | |
for code in price.keys(): | |
li.append({'code': code, 'mean': price[code]['geo_mean']}) | |
sorted_li = sorted(li, key=(lambda x: x['mean']), reverse=True) | |
# 좀더 한 줄에 복잡하게 하는 방법 | |
sorted_li2 = sorted(price.keys(), key=(lambda x: price[x]['geo_mean']), reverse=True) | |
print(sorted_li) | |
print(sorted_li2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment