Tagged Questions
1
vote
2answers
33 views
Optimizing the rounding of all elements in a 2-dimensional array
I have a 2 dimensional numpy array, and I would like each element to be rounded to the closest number in a sequence. The array has shape (28000, 24).
The sequence, for instance, would be [0, 0.05, ...
0
votes
1answer
7 views
reprojectImageTo3D() typeError, OpenCV Python
I'm not able to use reprojectImageTo3D() using python in the latest openCV version.
I keep getting "TypeError: disparity is not a numpy array". It's an iplImage of course.
disparityImg = CreateImage( ...
0
votes
1answer
51 views
Python: How to reduce run time?
I have a question how to reduce the run time.
The code I made is Python. It takes a huge data set as input, process it, calculate and write output to an array. Most calculations may be quite simple ...
0
votes
0answers
18 views
Python: Pixel values in image display?
Using any of the numpy, scikit-image libraries, I can easily load and display an image as an ndarray. However, I'd like some sort of display where I can move the cursor around the image, and see the ...
6
votes
2answers
29 views
How can one efficiently remove a range of rows from a large numpy array?
Given a large 2d numpy array, I would like to remove a range of rows, say rows 10000:10010 efficiently. I have to do this multiple times with different ranges, so I would like to also make it ...
0
votes
1answer
10 views
Issue : Installing Opencv and python 2.7.5 on Mac
I am trying to install OpenCV on MacOs
I am folwoing this tutorial
http://www.jeffreythompson.org/blog/2013/08/22/update-installing-opencv-on-mac-mountain-lion/
When I reach this point, I got this ...
0
votes
0answers
18 views
Segmentation fault during 'import scipy' and 'import numpy'
I want to use theano on my MacOS 10.9 Maverick. It used to work fine on 10.8 Lion. But there are some issues with 10.9.
Specifically, when I typed 'import numpy' or 'import scipy', it crashed and the ...
0
votes
0answers
8 views
Upgrading Scipy 0.10 on Red Hat Linux Server 5.5 (Tikanga)
I am trying to upgrade from scipy 0.10 to 0.13 on Red Hat Linux 5.5. I was able to install and upgrade numpy to 1.8.0 through pip, but when I try to use pip to upgrade scipy 0.10 it tells me that it ...
4
votes
1answer
41 views
Find max since condition in pandas timeseries dataframe
I'm trying to find the max since condition was true in a pandas dataframe. I've searched for similar questions and read the documentation but haven't been able to find this problem discussed. To ...
1
vote
0answers
29 views
Compute Higher Moments of Data Matrix
this probably leads to scipy/numpy, but right now I'm happy with any functionality as I couldn't find anything in those packages. I have a matrix that contains data for a multi-variate distribution ...
1
vote
1answer
36 views
Combining Numpy Arrays in Blockwise Form
I have three Numpy matrices
a = np.matrix('1 2; 3 4')
b = np.matrix('5 6 7; 8 9 10')
c = np.matrix('1 2 3; 4 5 6; 7 8 9')
and I would like to make the following block matrix:
M = [a b ; 0 c],
...
0
votes
2answers
28 views
Python: Save data with floats and strings with np.savetxt
I am trying to save an array consisting of both floats and one column of strings, and I am getting some really weird results. This is what I have tried:
data = np.column_stack((f1, f2, f3, s1))
The ...
0
votes
1answer
26 views
What is record array in pandas?
I found the following code:
df.to_records(index=False)
I try to figure out what it does. I found this page that says:
Convert DataFrame to record array. Index will be put in the ‘index’
field ...
0
votes
2answers
25 views
Check for empty data file (only header) in Python
What is the most elegant (and/or Pythonic) way to check that a data file has only a header before using numpy.loadtxt or numpy.genfromtxt to load columns of data into numpy arrays?
I have a quantum ...
2
votes
0answers
41 views
rgb_to_hsv and backwards using python and numpy
I tried to execute this code here as described in this answer. Bu I can't seem to get away from dividing with zero value.
I tried to copy this code from caman Js for transforming from rgb to hsv but ...