Question: Define a function a function called `labels_of_smallest` that takes the inputs: two different numpy arrays, the first one corresponding to a numeric column and the

Define a function a function called `labels_of_smallest` that takes the inputs: two different numpy arrays, the first one corresponding to a numeric column and the second one corresponding to a label column. Note that the i-th element of the numeric column corresponds to the i-th element of the label column. The third input should be a positive integer `n`. Your function should execute the following steps: - concatenate the numeric and the label columns - create a new dataframe with columns `num` and `lab` with the concatenation - sort the values by the `num` column Your python function should return a list (or numpy array) `df` of the `n` smallest labels corresponding to the n smallest values in the numeric array. **NOTE:** Make sure the order of labels corresponds to the order of values. Hint: The labels are found in `har_train_labels` or `y`. The function `np.concatenate()` might be useful for this or subsequent exercises

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the Python function that implements the labels of smallest functionality as per the given requ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!