I have a dictionary as follows:
test = {
"Name": ["Bimal", "Kamal", "Hari", "Ram", "Shyam"],
"Age": [12, 24, 23, 19, 17]
}
and I want to sort it based on name
so that the age of Kamal
must remain 24 after sorting.
So, what I want as final dictionary is:
test = {
"Name": ["Bimal", "Hari", "Kamal", "Ram", "Shyam"],
"Age": [12, 23, 24, 19, 17]
}
I can easily do it with pandas
but I wanted an efficient way to do it without using pandas. Is there any way to do it efficiently?