numpy.compress (condition, array, axis = none, out = none): returns selected slices of the array along the specified axis that satisfy the axis.
condition: [array_like] Condition on the basis of which user extract elements. Applying condition on input_array, if we print condition, it will return an arra filled with either True or False. Array elements are extracted from the Indices having True value. array: Input array. User apply conditions on input_array elements axis: [optional, int] Indicating which slice to select. By Default, work on flattened array [1-D] out: [optional, ndarray] Output_array with elements of input_array, that satisfies condition
Copy of array with elements of input_array, that satisfies condition and along given axis
< code class = "functions"> print
Original array: [[0 1] [2 3] [4 5] [6 7] [8 9]] Sliced array: [[2 3]] Sliced array: [[2 3]]
These codes will not work for online IDs. Please run them on your systems to see how they work.
This article is provided by Mohit Gupta_OMG