Category "numpy"

numpy and cv2, no modules available after installation via pip on linux

I installed opencv and numpy using pip on debian 11.2 with python 3.9. In visual studio the modules aren't available and terminal returns: Traceback (most recen

NumPy adds a dot after each element of an array which I can’t strip

I am trying to write code which generates a sound file based on a series of frequencies I give it, but I have reached a point where compiling the arrays of inte

Initializing a class with numpy array question

So I have defined the following function to be entered into a class: MatrixConverter(arr) Which works exactly how I want it to, taking in a numpy array as argu

Difference between cupy.asnumpy() and get()

Given a CuPy array a, there are two ways to get a numpy array from it: a.get() and cupy.asnumpy(a). Is there any practical difference between them? import cupy

Decypher AIFF File Contents with Python, AIFC

I am trying to extract values of an AIFF sound file to do some processing (FFT, frequency content, filter modeling, etc.). I have used AIFC to extract the para

TypeError: lowerb is not a numpy array, neither a scalar

I needed to run some parts of the code in GPU using cupy instead of numpy. So, I only made comment out for this line # import numpy as np and used this line ins

Decypher AIFF File Contents with Python, AIFC

I am trying to extract values of an AIFF sound file to do some processing (FFT, frequency content, filter modeling, etc.). I have used AIFC to extract the para

Is there something like np.linspace for 3D lines?

I have a 3x1 point vector representing the start point of some line, and a 3x1 point vector representing the end of some line. I would like to sample an arbitra

Plot Cassini ovals in Python using numpy and matplotlib

I am trying to plot Cassini ovals in Python using these parametric equations for x,y. https://mathcurve.com/courbes2d.gb/cassini/cassini.shtml Here is my progra

Combinations divided into rows with no repetition of elements

I'm working with lists in Python. I have a list of colleagues which is colleagues=['Jack', 'Jessica' 'John', 'Mark', 'Mary', 'Paul'] I want to calculate all po

Matlab wrapToPi and python np.unwrap

I am trying to port my code from Matlab to Python. Most of it seems to work except Matlab's function wrapToPi I am using numpy's unwrap function np.unwrap

"RuntimeError: implement_array_function method already has a docstring", trying to import numpy. How do I solve this?

I am trying to run a script importing numpy, and it shows this error: Traceback (most recent call last): File "C:/Users/<user>/pycharm/<my_project>

The dimension orders of the Numpy 3D array are designed to z, x, y. Are there any advantages?

I think that the x,y,z order is more intuitive for a 3D array, just as Matlab does. For example, If someone tells me an array is 2x3x4, I will think it is 2 row

Trying to replace part of array to another array, get error ValueError: assignment destination is read-only

I have two arrays with pixels, I need to replace the first part of array 'pixels_new', to array 'pixels_old' pixels_old = numpy.asarray(im) #picture 100X100 pix

Intersect float rows in two numpy matrices with precision

I'm looking for rows in B which are close to any of the rows in A example: eps = 0.1 A = [[1.22, 1.33], [1.45, 1.66]] B = [[1.25, 1.34], [1.77, 1.66], [1.44, 1.

Pandas Pivot table - How compute the following default ratio?

I am able to compute the default rate in number (e.g, the percentage of customers falled into default), with the code below, getting the following output: impor

How to generate a sphere in 3D Numpy array

Given a 3D numpy array of shape (256, 256, 256), how would I make a solid sphere shape inside? The code below generates a series of increasing and decreasing ci

Pythonic way to get both diagonals passing through a matrix entry (i,j)

What is the Pythonic way to get a list of diagonal elements in a matrix passing through entry (i,j)? For e.g., given a matrix like: [1 2 3 4 5] [6 7 8

Python-AttributeError: 'int' object has no attribute 'decode'" when trying to call the GML file on NetworkX

Premise・What I want to achieve I'm going to use Python to read the GML file. Error Message Traceback (most recent call last): File "firstgml.py", line

Vectorize a function for a GroupBy Pandas Dataframe

I have a Pandas dataframe sorted by a datetime column. Several rows will have the same datetime, but the "report type" column value is different. I need to se