I want to defining the following function: def f(x,y): return pow(x, 1/3) + y x = np.linspace(-1, 1, 10) y = np.linspace(-1, 1, 10) X, Y = np.meshgrid(x,
Is there a smart way to get the indices of all the entries within four points? In particular this is about the case where I have four points (x_1, y_1), (x_1, y
I'm using numpy where with multiple conditions to assign a category based on a text string a transaction description. Part of the code is below `import numpy as
Suppose that we have 2 2X2 numpy arrays: X=np.array([[0,1],[1,0]]) and I=np.array([[1,0],[0,1]]) Consider the Kronecker product XX=X^X where I have let the s
Basically I have these arrays print(img_arr[0].shape)->(returns) (122218,) print(img_arr1[0].shape)->(returns) (125204,) so when I did
I was trying to install numpy version 1.22.3 on a M1 Macbook with pip3, and pip3 says the package is present, but when I try to import the module, an error gets
Please, I know there are several issues related to this error of mine, but I'm learning, I don't understand almost anything, so please, if it's not asking too m
I have written a program where it takes a radius range(R to 5) and theta range(0 to 2pi). It converts the polar coordinates to Cartesian coordinates. Then I hav
How do I check which rows of one small array exists in another larger one? Given the following setup: final_batch = np.emtpy((batch_size,2)) batch_size = 4 a =
I have a, xarray dataset that is ocean color of the Atlantic Ocean called olci_ds. This dataset has dimensions of rows and columns and coordinates of lat, lon a
I am using python 3.9.8 and pycharm on a macbook m1. I have already installed openblas with homebrew but I still get the error below. I tried installing SciPy v
I am trying to write a code that calculates the speckle contrast of a laser line. Here is an example of an image that I would be analyzing: The image is black w
Hi all as with many peeps, I am new to python. Updated script that runs to completion but has a OptimizeWarning: Covariance of the parameters could not be estim
I currently have ~1000 files containing bytes. Each file contains a few thousand messages, each message has identical data types. I've tried several ways of rea
There is np.stack in NumPy, but is there an opposite np.unstack same as tf.unstack?
How can I use scipy.interpolate.interp1d when my x array is an N-D array, instead of a 1-D array, without using a loop? The function f from interp1d then needs
I have found return numpy array as image from fastapi but I am still struggling to show my image which just appears as a white square. I read an array into io.B
I am getting errors while generating maps of h3 moments in python for an image file called "image_test". The error apparently is for the shape of the values tha
If I have two arrays that are identical except for a shift: import numpy as np from scipy import signal x = [4,4,4,4,6,8,10,8,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4] y =
I have a few dataframes that I'm merging based on known, populated fields. The resulting dataframe will always contain a set of columns, but may or may not have