Tagged Questions
0
votes
1answer
26 views
Creating rank 3 numpy arrays
I would like to create a rank 3 array, using numpy, such that the array resembles a stack of 9x9 rank 2 arrays. Each of these arrays will be completely filled with ones, twos, threes, etc.
So, ...
1
vote
0answers
23 views
f2py: Exposing parameters from “used” modules
I assume that this question has been addressed somewhere, but I have spent an inordinate amount of time looking around for the answer including digging into the source code a bit. I have tried to put ...
3
votes
1answer
41 views
Anaconda's NumbaPro CUDA Assertion Error
I am trying to use NumbaPro's cuda extension to multiply large array matrixes. What I want in the end is to multiply a matrix of size NxN by a diagonal matrix that would be fed in as a 1D matrix ...
2
votes
0answers
27 views
Parsing a PDB file with multiple structures into an array
I have a PDB file with a few thousand structures, and I would like to save the position coordinates of, say, the alpha carbons of the first ten structures into a numpy array. I can parse a PDB file ...
1
vote
0answers
18 views
Numpy: binning data with ties according to percentiles
I want to bin my data into 10 bins (histograms) using percentile ranges:
bins = [0, 10th-percentile(myData), 20th-percentile(myData), 30th..., 90th-percentile(myData), +inf]
So in order make a ...
0
votes
2answers
26 views
numpy loadtxt skip first row
I have a small issue when I'm trying to import data from csv files with numpy's loadtxt function. Here's a sample of the type of data files I have.
Call it 'datafile1.csv':
# Comment 1
# Comment 2
...
2
votes
1answer
27 views
numpy find span where condition is true
Imagine I have a numpy array and I need to find the spans/ranges where that condition is True. For example, I have the following array in which I'm trying to find spans where items are greater than 1:
...
0
votes
1answer
37 views
How to install numpy with pip
I'm trying to install numpy on my Mac.
I'm currently using OS X 10.7.3 and Python version 2.7 (according to which python).
I tried pip install numpy in the command line and it displayed:
Could ...
1
vote
0answers
23 views
Getting NLTK running w/NumPY and matplotlib on OS 10.8
Just to be honest at the beginning here: I have no experience installing Python and its various modules. I am trying to work through Natural Language Processing with Python to learn a bit about how ...
1
vote
2answers
49 views
Confusion in array operation in numpy
I generally use MATLAB and Octave, and i recently switching to python numpy.
In numpy when I define an array like this
>>> a = np.array([[2,3],[4,5]])
it works great and size of the array ...
3
votes
1answer
80 views
Numpy: outer product of n vectors
I'm trying to do something simple in numpy, and I'm sure there should be an easy way of doing it.
Basically, I have a list of n vectors with various lengths. If v1[i] is the i'th entry of the first ...
1
vote
0answers
31 views
Follow up on how to extract unique rows from a matrix in numpy
A follow up question on:
How can i use the unique(a, 'rows') from MATLab at python?
The answer there explains how to get the unique rows. Yet matlab also returns the frequency of each row ...
1
vote
1answer
27 views
How to replace specific entries of a Numpy array based on its content
So lets say I have a simple matrix made out of ndarrays (just an example of how part of the data might look like):
import numpy as np
a = np.asarray([['1.0', 'Miami'],
['2.0', 'Boston'],
...
3
votes
2answers
40 views
Numpy 2d and 1d array to latex bmatrix
I'm looking for a clean way to migrate numpy arrays to latex bmatrix. It should work for both 2d arrays and horizontal and vertical 1d array.
Example
A = array([[12, 5, 2],
[20, 4, 8],
...
22
votes
1answer
293 views
Why is numpy.any so slow over large arrays?
I'm looking for the most efficient way to determine whether a large array
contains at least one nonzero value. At first glance np.any seems like the
obvious tool for the job, but it seems unexpectedly ...