Skip to main content

Questions tagged [numpy]

NumPy is the fundamental package for scientific computing with the programming language Python.

52 votes
3 answers
172k views

I'm trying to find the closest point (Euclidean distance) from a user-inputted point to a list of 50,000 points that I have. Note that the list of points changes all the time. and the closest distance ...
dassouki's user avatar
  • 1,101
25 votes
2 answers
28k views

I am going to send a C++ array to a Python function as NumPy array and get back another NumPy array. After consulting with NumPy documentation and some other threads and tweaking the code, the code is ...
rowman's user avatar
  • 304
25 votes
1 answer
1k views

I've been working on a simple neural network implemented in python. Currently, it seems to be learning, but unfortunately it doesn't seem to be learning effectively. The graph below shows the output ...
penalosa's user avatar
  • 269
24 votes
2 answers
58k views

Objective: Crop the image so only the number stays in the image Problem: Slow Performance I have code that crops an image. The image pixels are 0 or 255. There are no values between. The ...
user avatar
24 votes
3 answers
5k views

I wrote this code to remove points that create a straight line when plotted. For instance, this has many points in a straight line: ...
James Schinner's user avatar
24 votes
2 answers
96k views

As I've described in a StackOverflow question, I'm trying to fit a NumPy array into a certain range. Here is the solution I currently use: ...
Seanny123's user avatar
  • 1,617
21 votes
1 answer
762 views

I have a function that accepts a \$255\times1024\$ array and remaps it to another array in order to account for some hardware related distortion (lines that should be straight are curved by the lens). ...
wes3449's user avatar
  • 313
20 votes
4 answers
17k views

I am using OpenCV to process an image, and in my code, I have to check / edit each pixel separately: ...
Bart Friederichs's user avatar
19 votes
1 answer
6k views

Following this idea for pretty printing of numpy ndarrays, I have developed a very primitive prototype: ...
Foad's user avatar
  • 379
19 votes
2 answers
11k views

I am trying create an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of ...
Seanny123's user avatar
  • 1,617
18 votes
2 answers
97k views

I wrote a function to calculate the gamma coefficient of a clustering. The bottleneck is the comparison of values from dist_withing to ...
embert's user avatar
  • 445
18 votes
1 answer
7k views

When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
Graipher's user avatar
  • 41.7k
17 votes
1 answer
616 views

Me and a couple of mates sometimes play a game called Warhammer. When playing the game you have options of what each model attacks. This can lead to situations where you know if you shoot with 100% of ...
Peilonrayz's user avatar
  • 44.6k
17 votes
1 answer
583 views

Background: Motivation behind writing the following code is originated in the area of computer vision. More specifically – image rectification. In order to obtain rectified images, one has to find a ...
Georgy's user avatar
  • 1,997
16 votes
1 answer
451 views

I have spent about more than a year in python, but I come from biology background. I should say I have got some understanding of for-loop and nested-for-loop to workout the solution to the problem I ...
everestial's user avatar

15 30 50 per page
1
2 3 4 5
51