Skip to main content

Question list filters

Filter by
Sorted by
Tagged with
Score of 0
2 answers
104 views

I am working with huge matrix of small numbers using numpy and getting the following error: MemoryError: Unable to allocate 9.72 TiB for an array with shape (3268760, 3268760) )data type uint8" ...
Score of 2
2 answers
264 views

I'm trying to change a pixel to red. However, when I run the code, the pixel remains unedited. Can you help? import cv2 as cv import os import matplotlib.pyplot as plt def readAndWriteImage(): ...
Score of 2
1 answer
168 views

I have large matrices that contain both real numbers and nan. I want to find the most efficient way to determine if a matrix contains only zeros and/or nan entries. If it does, the code should return ...
Score of 1
0 answers
148 views

Consider import numpy as np N = 2000 a = np.ones((N, 5*N), dtype=np.float64, order="C") for _ in range(1000): x = np.array2string(a[0], threshold=np.inf) and import numpy as np N = ...
Score of 3
1 answer
151 views

I am running into an issue where my dictionary is not picking up full strings attached to variables, but instead just the first letter. import numpy as np import random trials = 5 d = {'trial': np....
Score of 4
2 answers
180 views

I want to show the distribution of angle estimations using a boxplot. The problem is that angles wrap around (I chose +-180° as the wrapping point, but the same applies to 0/360°). Matplotlibs boxplot ...
Score of -2
0 answers
157 views

I want some straightforward way to model a for all values of the array like in a for loop. the only way I found was using filtered arrays which is very very tedious. This function takes a number turns ...
Score of -1
1 answer
114 views

I am using Numpy's F2PY to compile some Fortran code for use in Python, and I am trying to test the performance of the F2PY-generated interface using the -DF2PY_REPORT_ATEXIT compilation flag. ...
Score of 2
0 answers
109 views

I'm a windows user. I want to install numpy/scipy using openBLAS threading via conda. If I make an environment like this name: test channels: - conda-forge dependencies: - python - pip - numpy ...
Score of 2
3 answers
174 views

I'm trying to calculate the quality property of a storage tank over time. The quality is the weighted average of the previous period's quality (weighted by closing stock balance) and the current ...
Score of 2
2 answers
119 views

I am trying to make a Python imgui_bundle cartopy app and even though I am making an ndarray, I get an error stating I need a numpy.ndarray even though when I type() it states it is an numpy.ndarray. ...
Score of 2
1 answer
141 views

I want to take the transpose of a square matrix about the anti-diagonal axis: I tried to adapt the code from a C++ post to run on Python to transpose my matrix: import numpy as np def swapEl(mat): ...
Score of 2
2 answers
133 views

I'm working with a continuous, 1-dimensional ndarray of coordinates in the form [x1, y1, z1, x2, y2, z2, ...]. I need to now swap the order from X,Y,Z to X,Z,Y, so that the output array has the form [...
Best practices
0 votes
6 replies
165 views

I have an array with almost infinite dimensions. I would like to iterate it from top left to bottom right, and when a certain threshold is reached iteration can be stoped. I create our test array. mat ...
Advice
0 votes
4 replies
147 views

#Multiple Layers import numpy as np class NeuralNetwork: def __init__(self, input_size, hiddenLayerSizes, output_size): self.input_size = input_size self.hiddenLayerSizes = ...

15 30 50 per page
1
2 3 4 5
7682