I am a newbie to Python and not fully sure how to work with dictionaries. I want to sort one of the dictionaries with another one. So I have something like given below. Each of the vertex features is a list.
vertex_features = ['Charge', 'Time', 'TimeDelta', 'TimeSinceLastPulse']
..........
..........
a = {feature : [] for feature in vertex_features }
I want to sort the Time feature (and get the corresponding Charge, Time Delta etc.), which I did by
hit_order = np.argsort(features['Time'])
However when I try
for feature in features:
features[feature] = features[feature][hit_order]
It gives the error
TypeError: only integer scalar arrays can be converted to a scalar index
I have also tried
for feature in features:
features[feature] = features[feature][for i in hit_order]
But unable to get the sorted lists. I am not fully sure if I understand what I am doing wrong with the sorting here. Help is very much appreciated.