0
votes
0answers
26 views
C# wrapper for a Python piece of code
Is it much struggle to write a C# wrapper for some existing Python function ? I would like to use numpy methods in a C# code, binding python code to C# code.
I am sorry there are not so many ...
9
votes
1answer
96 views
Summing over pair of indices (or more) in Python
One way to calculate the Gini coefficient of a sample is using the relative mean difference (RMD) which is 2 times the Gini coefficient. RMD depends on the mean difference which is given by:
So I ...
2
votes
2answers
69 views
Numpy: Loop alternative, Optimization
Since I am new to Numpy , I am facing problems implementing a particular code that I wrote in C++
for(i=0;i<h;i++)
{
for(j=0;j<w;j++)
{
val=0;
...
1
vote
2answers
29 views
Is there any `itemgetter` equivalent for `numpy.ndarray`?
When I call itemgetter with a numpy.ndarray, I get a tuple.
In [1]: import numpy as np
In [2]: import operator as op ...
2
votes
2answers
52 views
Efficient colorization of numpy matrix by value?
I have a numpy ndarray that looks something like:
[[0, 0.25, 1, ...., 0.5, 0.23 ],
[0.3, 0.75, 1, ..., 0.5, 0.37 ],
...,
...,
[0, 0.25, 1, ...., 0.5, 0.23 ],
[0.3, 0.75, 1, ..., 0.5, 0.37 ]]
...
1
vote
1answer
43 views
How can I combine one column and a matrix into a larger matrix with `numpy`?
I'm trying to normalize a matrix by doing (X - means) / variance to each row.
Since I am implementing this with MapReduce, I first calculate the means and standard variance for each column, and then ...
0
votes
1answer
38 views
Pass regex to delimiter field in python's csv module or numpy's genfromtxt / loadtxt?
I have tabulated data with some strange delimination (i.e. groups of values separated by commas, seperated from other values by tabs):
A,345,567 56 67 test
Is there a clean and clever way of ...
6
votes
1answer
100 views
Parseval's theorem in Python
I'm trying to get some grip on pythons fft functionality, and one of the weird things that I've stumbled on is that Parseval's theorem doesn't seem to apply, as it gives a difference of about 50 now, ...
-1
votes
1answer
39 views
delete ndarray numpy row if it has wrong data type
I have this huge 5 million * 42 ndarray I load from a CSV file. After I do some processing and try to save it into another CSV file with type float.
I get the following error:
...
-2
votes
1answer
59 views
INSERT Numpy ND array to a MySQL Table
I am new to Python and I have an ND numpy array named full. It's structure is like this:
-------------------
id | url | date
-------------------
1 url1 date1
2 url2 date2
3 ...
3
votes
1answer
94 views
+50
Use Boost-Python to calculate derivative of function defined in python
I want to write a Boost-Python program to take a symbolic python function from user and evaluate its derivative in my program.
For example the User provide a python file (Function.py) which defines a ...
0
votes
1answer
23 views
Trying to install Python audiolab module, module not found
Not well experienced with doing installs. I finally got scikits.audiolab-0.11.0 installed, I think. Now the module cannot be found.
from audiolab import *
Traceback (most recent call last):
File ...
-3
votes
2answers
53 views
Python NumPy doesn't resize correctly
Why is this code not working? I can't get this numpy array to resize correctly.
import numpy
a = numpy.zeros((10,10))
a[3,2] = 8
a.resize((5,5))
if a[3,2] == 8:
print "yay"
else:
print "not ...
0
votes
0answers
23 views
attribute error on numpy import with python 2.7 and wxpython
I am struggling to get an ide working for python 2.7 with numpy, scipy, matplotlib and wxpython/PyQt installed. Running the ide spyder throws up the message "module 'object' has no attribute 'core'" ...
1
vote
0answers
41 views
numpy 1D and 2D histogram from arrays
have you any idea, how I can bin 3 arrays to a histogram. My arrays look like
Temperature = [4, 3, 1, 4, 6, 7, 8, 3, 1]
Radius = [0, 2, 3, 4, 0, 1, 2, 10, 7]
...