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
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
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
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>
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
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
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.
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
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
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
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
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
Let's say I have a numpy array where I would like to swap all the 1's to 0 and all the 0's to 1 (the array will have other values, and there is nothing special
I have N number of points, for example: A = [2, 3] B = [3, 4] C = [3, 3] . . . And they're in an array like so: arr = np.array([[2, 3], [3, 4], [3, 3]]) I nee
I am currently trying to feed an image sequence as a single input entity to my CNN. I found the numpy utility numpy.lib.stride_tricks.sliding_window_view My ima
My nox session is defined like: @nox.session(python=["3.10", "3.9.10"]) def mypy(session: Session) -> None: args = session.posargs or locations insta
I am trying to produce a heat map where the pixel values are governed by two independent 2D Gaussian distributions. Let them be Kernel1 (muX1, muY1, sigmaX1, si
I have tried multiple solutions and way around to solve this issue, probably something is still I am missing. I want to insert a list of values to my database.
This application is in analysis of astrophysical data, but the problem is purely a question of programming/syntax. I want to go through my 53 bins of data (each
I've looked at the Sklearn stratified sampling docs as well as the pandas docs and also Stratified samples from Pandas and sklearn stratified sampling based on