0
votes
2answers
10 views
How to iterate Numpy array and perform calculation only if element matches a criteria?
I want to iterate a numpy array and process only elements match with specific criteria. In the code below, I want to perform calculation only if element is greater than 1.
a = np.array([[1,3,5],
...
0
votes
0answers
12 views
MemoryError when using Pandas.join
A DataFrame is created by pulling from a postgresql database. However doing listings.join is getting me MemoryError.
The system has 24GB RAM, running Python 64bit on Windows 8 64bit.
Problem: Before ...
1
vote
1answer
36 views
Checking existence of an array inside an array of arrays python
I have a numpy array of arrays:
qv=array([[-1.075, -1.075, -3. ],
[-1.05 , -1.075, -3. ],
[-1.025, -1.075, -3. ],
...,
[-0.975, -0.925, -2. ],
[-0.95 , ...
2
votes
2answers
48 views
NumPy Matrix operation without copying
How I can make, for example, matrix transpose, without making a copy of matrix object? As well, as other matrix operations ( subtract a matrix from the matrix, ...). Is it beneficial to do that?
1
vote
1answer
36 views
Error for my plot and calculation of FWHM
I found and copied this code to get the FWHM from Finding the full width half maximum of a peak (2nd to the last answer). My code below uses my own data. The plot generated looks wrong as my data ...
3
votes
2answers
109 views
Naming dimensions in python?
There is something that I would very appreciate, it is the ability to name the dimensions in an array in python. For example I have a numpy array with 3 dimensions and I will regularly have to sum it ...
2
votes
6answers
66 views
Python: Find number of occurrences of given array within two-dimensional array
How best to find the number of occurrences of a given array within a set of arrays (two-dimensional array) in python (with numpy)?
This is (simplified) what I need expressed in python code:
patterns ...
2
votes
1answer
51 views
Python numpy indexing does not work
import numpy as np
dx = 8
dy = 10
bx = 5.34
by = 1.09
index = np.zeros((dx+dy),dtype = 'int32')
for i in np.arange(1,dy+1):
for j in np.arange (1,dx+1):
if i-by > 0:
theta = ...
2
votes
1answer
19 views
numpy.unique acts weird with numpy.array of objects
This question is related to (but not the same as) "numpy.unique generates a list unique in what regard?"
The setup:
import numpy as np
from functools import total_ordering
@total_ordering
class ...
0
votes
1answer
27 views
Python, numpy, string decomposition (string from Abaqus AFXComTableKeyword.getValues())
From the getValues()method the AFXComTableKeyword class returns a string like:
test = "('mat_huehne_2008', '0.125', '24.0'),('', '', '-24.0'),('', '', '41.0')"+\
",('', '', '-41.0'),('', '', ...
2
votes
2answers
52 views
Translate Matlab's vector assignment into Python form
I'm trying to translate some Matlab code into Python (using NumPy). I'm not very familiar with Matlab, and I've encountered a line that I'm having trouble parsing:
w(idx(1:p, 1), 1) = v(idx(1:p, 1), ...
2
votes
1answer
35 views
Python numpy 2D array indexing
I am quite new to python and numpy. Can some one pls help me to understand how I can do the indexing of some arrays used as indices. I have the following six 2D arrays like this-
array([[2, 0],
...
1
vote
1answer
29 views
Using old version of numpy even with a newer version installed
I have used easy_install to install numpy to install numpy 1.7.1, but when I check my version in python:
python -c "import numpy; print numpy.version.version"
It says 1.6.2
What am I doing wrong?
...
-2
votes
0answers
29 views
Where to insert train data and test data path? [closed]
While the algo is complex, my questions are simple?
How do I get this algo to use my train data? (located at "C:\Train.csv")
How do I get this algo to predict on my test data (located at ...
3
votes
1answer
41 views
numpy.unique generates a list unique in what regard?
If you input an array with general objects to numpy.unique, the result will be unique based upon what?
I have tried:
import numpy as np
class A(object): #probably exists a nice mixin for this :P
...