Tagged Questions
2
votes
1answer
26 views
Python plot log scale set xticks?
I am trying to plot between in Log scale but there are problems ;
from pylab import *
import matplotlib.pyplot as pyplot
Ds = pow(10,5)
D = np.linspace(0, pow(10,6), 6)
alpha=1.44
beta=0.44
...
3
votes
0answers
48 views
Quadratic Program (QP) Solver that only depends on NumPy/SciPy?
I would like students to solve a quadratic program in an assignment without them having to install extra software like cvxopt etc. Is there a python implementation available that only depends on ...
1
vote
2answers
36 views
Array Indexing in multi dimensional numpy array
I'm new to numpy and trying to understand the following example from here. I'm having trouble understanding the output of
>>> palette[image]
When the indexed array a is multidimensional, ...
1
vote
1answer
31 views
calculations using np.arrays in python
I am really struggling to understand how to perform calculations with numpy arrays.
myList = open('key_resp.csv')
newList = np.array(myList)
newList2=sorted(newList)
newLists = ...
0
votes
1answer
32 views
performing calculation in each line of datafile
I am new to Python and I just want to perform a simple calculation on all data in a file. I have the median number from another file and for each line in dataFast I want to do this:
medianNum - ...
-1
votes
2answers
25 views
Puzzled on the ndim from Numpy
import numpy as np
a = np.zeros((5,2,3,4), dtype=np.int16)
print a.ndim
b = np.zeros((2,3,4), dtype=np.int16)
print b.ndim
Above is my code. the output is:
4
3
I have checked the page ...
1
vote
1answer
29 views
Python: change numpy array with NaNs to array with numbers and '--'
I have a numpy array with some floats and some nans:
a = [ 8.08970226 nan nan 8.30043545 nan nan nan nan]
I want to convert it to an array (for printing in Latex) to the mixed form:
a = ...
1
vote
0answers
40 views
out-of-core SVD in python
I need to run the python (numpy) code:
numpy.linalg.svd(M.dot(M.T))
but M is a dense float64 matrix of shape 100224 x 349800
Obviously, it does not fit in memory.
I know pytables is supposed to ...
2
votes
1answer
43 views
numpy array that is (n,1) and (n,)
What is the difference between a numpy array (lets say X) that has a shape of (N,1) and (N,). Aren't both of them Nx1 matrices ? The reason I ask is because sometimes computations return either one or ...
-1
votes
1answer
40 views
Python can't multiply sequence by non-int of type 'float'
I am trying to evaluate a formula, np is numpy ;
Ds = pow(10,5)
D = np.linspace(0, pow(10,6), 100)
alpha=1.44
beta=0.44
A=alpha*(D/Ds)
L=1.65
buf2=L/4.343
buf=pow(-(alpha*[D/Ds]),beta)
value=exp(buf)
...
2
votes
1answer
26 views
Getting the top-K relevant document from a similarity numpy.ndarray
I'm using document similarity as defined here.
My question is how to do I get the most relevant documents from the numpy.ndarray Is there a way to sort the numpy array and get the top-K relevant ...
6
votes
3answers
44 views
Translate every element in numpy array according to key
I am trying to translate every element of a numpy.array according to a given key:
For example:
a = np.array([[1,2,3],
[3,2,4]])
my_dict = {1:23, 2:34, 3:36, 4:45}
I want to get:
...
1
vote
2answers
63 views
For loop speed with Numpy
I am trying to get this code running fast in python however I am having trouble getting it to run anywhere near the speed it runs in MATLAB. The problem seems to be this for loop which takes about 2 ...
2
votes
0answers
39 views
Multidimensional Scaling Fitting in Numpy, Pandas and Sklearn (ValueError)
I'm trying out multidimensional scaling with sklean, pandas and numpy. The data file Im using has 10 numerical columns and no missing values. I am trying to take this ten dimensional data and ...
-1
votes
1answer
56 views
How to use matplotlib in my Python Program [closed]
Have a program written in Python. Matplotlib need to draw graphics using the program. "dalgafonksiyonu" and "x" by using the values have to create the chart. Single "for" and "while" loops, I do not ...