I have a data array looks, for example, like:
data = [
[1.4, 2.6, 7.3, 4.2],
[1.1, 2.0, 6.4, 1.0],
[5.1, 6.2, 5.3, 9.9]
]
and another array with class labels:
class_labels = ['a', 'b', 'a', 'b']
Each of the class labels corresponds to certain floats in each element of the data array (e.g., class 'a' corresponds to 1.4 and 7.3 from data[0], 1.1 and 6.4 from data[1], and 5.1 and 5.3 from data[0]).
I understand from other posts how I could go about sorting one array based on another array, but is it possible to sort the class_labels array alphabetically, also sorting the corresponding floats within each element of the data array?
It's possible I've totally gone about this wrong - if I want to be able to later access certain floats from each element (i.e., only floats corresponding to a given class label), will that be possible?
Thanks for any advice!