Hi, There,
Here is a sample code using `numpy.bincount`
import numpy as np
a = np.array([1.0, 2.0, 3.0], dtype=np.float128)
b = np.array([1, 2, 0], dtype=np.int)
c = np.bincount(b, weights=a)
If run it, I get the following error report:
> 1 c = np.bincount(b, weights=a)
Thanks, it is very useful.
On Wed, Mar 9, 2011 at 7:41 PM, Benjamin Root wrote:
> This is a very good webpage that helped me when I was transitioning from
> matlab to numpy. I hope it is helpful for you as well.
>
> http://www.scipy.org/NumPy_for_Matlab_Users
>
> Ben Root
>
>
__
-- Forwarded message --
From: shu wei
Date: Wed, Mar 9, 2011 at 6:34 PM
Subject: Re: [Numpy-discussion] How to sum weighted matrices
To: Nicolas SCHEFFER
Thanks very much.
I just copied the code your guys gave me. Both of them work great
I used to program in Matlab. not
matrices = np.array([matrix1,matrix2])
>
> weighted_sum = np.tensordot(weights, matrices, (0,0))
>
> --
>
> On Mon, Mar 07, 2011 at 06:16:15AM -0600, shu wei wrote:
> >Hello all,
> >
> >I am new to python and numpy.
> >My quest
Hello all,
I am new to python and numpy.
My question is how to sum up N weighted matrices.
For example w=[1,2] (N=2 case)
m1=[1 2 3,
3 4 5]
m2=[3 4 5,
4 5 6]
I want to get a matrix Y=w[1]*m1+w[2]*m2 by using a loop.
My original problem is like this
X=[1 2 3,
3 4 5,
4 5 6]
Hi, Pierre:
Thanks for the reply. I can now actually turn a big list into a record array.
My question is actually how to join related record arrays in Python. This is
done in SAS by MERGE and PROC SQL and by merge() in R. But I have no idea how
to do it in Python.
Thanks.
Wei Su
--- On
Hi, All,
Coming from SAS and R, this is probably the first thing I want to do now that I
can convert my data into record arrays. But I could not find any clues after
googling for a while. Any hint or suggestions will be great!
Thanks a lot.
Wei Su
Hi, Francesc:
The codes do not work. Guess you forgot something there.
Thanks.
Wei Su
--- On Mon, 5/11/09, Francesc Alted wrote:
From: Francesc Alted
Subject: Re: [Numpy-discussion] List of arrays
To: "Discussion of Numerical Python"
Date: Monday, May 11, 2009, 10:40 AM
A
Hi, Stephen:
This is fantastic. I shall read your codes carefully next week. (I am taking
the rest of the week off for vacation.) Hopefully I am not so dumb that I need
to ask again.
Regards,
Wei Su
--- On Wed, 5/6/09, Stephen Simmons wrote:
From: Stephen Simmons
Subject: Re: [Numpy
Python module?
Thanks in advance.
Wei Su
--- On Tue, 5/5/09, Francesc Alted wrote:
From: Francesc Alted
Subject: Re: [Numpy-discussion] How to convert a list into a structured array?
To: "Discussion of Numerical Python"
Date: Tuesday, May 5, 2009, 7:10 AM
Welcome Wei!
A
Hi, Everyone:
This is what I need to do everyday. Now I have to first save data as .csv file
and the use csv2rec() to read the data as a record array. Anybody can give me
some advice on how to directly get the data as record arrays? It will save me
tons of time.
Thanks in advance.
Wei
structured array? using array()
will turn it into a text array, afaik. it is even better if anybody can show me
some tricks to download the data directly as a structured array.
Thanks a lot for the help.
Wei Su
BTW: I am also interested in Python's ability to handle large data. Any
Hi,
I just got my new intel core duo laptop. So I downloaded the new cygwin
(including everything) but couldn't get the numarray or numpy modules
installed correctly. I always got the following error. Can some one help?
Many thanks!
Wei
python setup.py install
13 matches
Mail list logo