All Questions

130
votes
20answers
53547 views

Find unique rows in numpy.array

I need to find unique rows in a numpy.array. For example: >>> a # I have array([[1, 1, 1, 0, 0, 0], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0], [...
88
votes
7answers
60089 views

Using numpy to build an array of all combinations of two arrays

I'm trying to run over the parameters space of a 6 parameter function to study it's numerical behavior before trying to do anything complex with it so I'm searching for a efficient way to do this. My...
64
votes
5answers
35162 views

Use numpy array in shared memory for multiprocessing

I would like to use a numpy array in shared memory for use with the multiprocessing module. The difficulty is using it like a numpy array, and not just as a ctypes array. from multiprocessing import...
47
votes
7answers
24327 views

Numpy: cartesian product of x and y array points into single array of 2D points

I have two numpy arrays that define the x and y axes of a grid. For example: x = numpy.array([1,2,3]) y = numpy.array([4,5]) I'd like to generate the Cartesian product of these arrays to generate:...
63
votes
11answers
32965 views

Split (explode) pandas dataframe string entry to separate rows

I have a pandas dataframe in which one column of text strings contains comma-separated values. I want to split each CSV field and create a new row per entry (assume that CSV are clean and need only be...
24
votes
3answers
4988 views

What is the difference between size and count in pandas?

That is the difference between groupby("x").count and groupby("x").size in pandas ? Does size just exclude nil ?
6
votes
5answers
1067 views

Find the row indexes of several values in a numpy array

I have an array X: X = np.array([[4, 2], [9, 3], [8, 5], [3, 3], [5, 6]]) And I wish to find the index of the row of several values in t...
8
votes
1answers
1271 views

Taking subarrays from numpy array with given stride/stepsize

Lets say I have a Python Numpy array array a. numpy.array([1,2,3,4,5,6,7,8,9,10,11].) I want to create a matrix of sub sequences from this array of length 5 with stride 3. The results matrix hence ...
322
votes
6answers
102209 views

Why NumPy instead of Python lists?

Is it worth my learning NumPy? I have approximately 100 financial markets series, and I am going to create a cube array of 100x100x100 = 1 million cells. I will be regressing (3-variable) each x with...
305
votes
3answers
162223 views

Simple Digit Recognition OCR in OpenCV-Python

I am trying to implement a "Digit Recognition OCR" in OpenCV-Python (cv2). It is just for learning purposes. I would like to learn both KNearest and SVM features in OpenCV. I have 100 samples (i.e. ...

Previous Next