cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to properly sort a dictionary by value of a key? [duplicate]

Kaniz
Community Manager
Community Manager
 
1 REPLY 1

Hubert-Dudek
Esteemed Contributor III

just use python dictionary comprehension with lambda for that:

dict(sorted(x.items(), key=lambda item: item[1]))

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.