advanced patterns with np.clip on 2D arrays when using axis parameter
I'm dealing with I'm experiencing unexpected behavior when using `np.clip` on a 2D array with the `axis` parameter set... My intention is to clip the values along a specific axis, but it seems that the output is not as expected. Hereβs the code I am using: ```python import numpy as np # Creating a 2D array data = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) # Attempting to clip values along axis 0 clipped_data = np.clip(data, a_min=3, a_max=7, axis=0) print(clipped_data) ``` I expected the output to clip values in each column independently, replacing values below 3 with 3 and values above 7 with 7. However, the output is: ``` [[3 2 3] [4 5 6] [7 7 7]] ``` Instead of clipping along the columns, it appears that the operation is being applied to the entire array. I also tried removing the `axis` parameter entirely, but it didn't yield the desired result either, resulting in the same output. I've checked the documentation for `np.clip`, and it states that the `axis` parameter is meant for multi-dimensional arrays, but I need to find any examples that clarify how it should be used. Am I misunderstanding how to use the `axis` parameter, or is this a known limitation? I'm currently using NumPy version 1.21.0, and I would appreciate any insights or recommendations on how to achieve the desired clipping along a specific axis. I'd really appreciate any guidance on this. I'm working with Python in a Docker container on Linux. Has anyone dealt with something similar? This is for a service running on Windows 10.