Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Filter by
Sorted by
Tagged with
Filter by Employee ID
0 votes
0 answers
76 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. ...
2 votes
0 answers
88 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 ...
2 votes
2 answers
149 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 ...
2 votes
2 answers
110 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. ...
2 votes
1 answer
132 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): ...
2 votes
2 answers
120 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
150 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
139 views

#Multiple Layers import numpy as np class NeuralNetwork: def __init__(self, input_size, hiddenLayerSizes, output_size): self.input_size = input_size self.hiddenLayerSizes = ...
2 votes
0 answers
97 views

I need to refer to the base attribute of arrays to keep track of whether I am currently handling some view of it or the base array itself. However, if I dump the array to a file with dill and load it ...
0 votes
1 answer
86 views

As explained in this answer it is possible to save an instance of a class and load it again using numpy save/load routines. However, if I do this with a derived class, I lose the reference to the ...
0 votes
1 answer
79 views

im struggle with an error when creating MRE. why these code : from pandas import DataFrame as df import numpy as np from sklearn.neighbors import NearestNeighbors as nrb from sklearn.decomposition ...
2 votes
1 answer
142 views

Suppose I have two integer numpy vectors a0 and a1 of the same length. I want to return unique pairs of elements of a0 and a1. For instance: a0 = np.asarray([0, 1, 4, 1, 0, 4]) # --> b0 = np....
2 votes
2 answers
194 views

I am trying to reformat the values in a dataframe column for a person's height from, for example, 5'8" to 5 Feet 8 Inches and I figure that I can at least replace the apostrophe and double quotes ...
1 vote
1 answer
104 views

i want find 2d index(from PCA). based on pivot_table vector at my custom metric. fastly. that's why im using KDTree. but because it, these error is occur: ValueError Traceback (most recent call last) ...
Best practices
1 vote
13 replies
184 views

import math import matplotlib.pyplot as plt import numpy as np m=50 def taylor_cos(x,n): sum=0 for i in range(0, n): sum=sum+ (((-1)**i) * (x**(2*i)) / math.factorial(2*i)) ...

15 30 50 per page
1
2 3 4 5
7683