Re: [Numpy-discussion] Numpy save / load

2010-06-21 Thread Vishal Rana
Thanks Robert On Mon, Jun 21, 2010 at 11:47 AM, Robert Kern wrote: > On Mon, Jun 21, 2010 at 13:40, Vishal Rana wrote: > > I have tried: > > x1=np.array([1,2,3,4]) > > x2=np.array(['a','dd','xyz','12']) > > x3=np.array([1.1

[Numpy-discussion] Numpy save / load

2010-06-21 Thread Vishal Rana
es So my record is lost and converted to ndarray, any idea? Thanks Vishal Rana ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
It helped, Thanks On Wed, Jun 16, 2010 at 10:39 AM, Robert Kern wrote: > On Wed, Jun 16, 2010 at 12:30, Vishal Rana wrote: > > Robert, > > Do I have to repeat it for each element in the list or is there a way I > can > > iterate the list and do it? > > new_lis

Re: [Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
Robert, Do I have to repeat it for each element in the list or is there a way I can iterate the list and do it? Thanks Vishal Rana On Wed, Jun 16, 2010 at 10:23 AM, Robert Kern wrote: > On Wed, Jun 16, 2010 at 12:15, Vishal Rana wrote: > > Hi, > > I have a list of np arra

[Numpy-discussion] Trimming the np arrays

2010-06-16 Thread Vishal Rana
Hi, I have a list of np arrays from which I create a np record array, but they all of of different length! How can I trim them all in place (for example I want to get last 10 elements of each)? Thanks Vishal Rana ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-16 Thread Vishal Rana
Thanks On Tue, Jun 15, 2010 at 8:49 PM, Robert Kern wrote: > On Tue, Jun 15, 2010 at 01:56, Vishal Rana wrote: > > Robert, > > As you said, I was able to get the results, but I now got a question as > > np.load('np.npz') returns me a object so > does >

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-14 Thread Vishal Rana
Robert, As you said, I was able to get the results, but I now got a question as np.load('np.npz') returns me a object so does that mean the data is read directly from the from the npz file and not all the data is loaded to the memory? Thanks Vishal Rana On Mon, Jun 14, 2010 at 5:08

Re: [Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-14 Thread Vishal Rana
Thanks Robert On Mon, Jun 14, 2010 at 5:08 PM, Robert Kern wrote: > On Mon, Jun 14, 2010 at 19:00, Vishal Rana wrote: > > Hi, > > I have dictionary of numpy record arrays, what could be fastest way to > > save/load to/from a disk. I tried numpy.save() but my dic

[Numpy-discussion] Fastest way to save a dictionary of numpy record arrays

2010-06-14 Thread Vishal Rana
Hi, I have dictionary of numpy record arrays, what could be fastest way to save/load to/from a disk. I tried numpy.save() but my dictionary is lost and cPickle seems to be slow. Thanks Vishal ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Error while upgrading to numpy 1.4.1

2010-06-14 Thread Vishal Rana
Thanks, it worked. On Mon, Jun 14, 2010 at 7:39 AM, Benjamin Root wrote: > > > On Mon, Jun 14, 2010 at 1:09 AM, David Cournapeau wrote: > >> On Mon, Jun 14, 2010 at 3:00 PM, Vishal Rana >> wrote: >> > Hi, >> > I am getting this error while upgr

[Numpy-discussion] Error while upgrading to numpy 1.4.1

2010-06-13 Thread Vishal Rana
152, in run File "/tmp/easy_install-5_dz2F/numpy-1.4.1/numpy/distutils/command/build_src.py", line 163, in build_sources File "/tmp/easy_install-5_dz2F/numpy-1.4.1/numpy/distutils/command/build_src.py", line 298, in build_library_sources File "/tmp/easy_install-5_d

Re: [Numpy-discussion] Serializing numpy record array

2010-06-13 Thread Vishal Rana
Thanks Robert, it worked. On Sun, Jun 13, 2010 at 6:23 PM, Robert Kern wrote: > On Sun, Jun 13, 2010 at 20:10, Vishal Rana wrote: > > Robert, > > There is no error on python side but on flex client which > > is "Channel.Call.Failed" faultDetail="NetConnecti

Re: [Numpy-discussion] Serializing numpy record array

2010-06-13 Thread Vishal Rana
thon data types so I am not sure if numpy dtypes will work with it or not, but it working on Mac OS X. Thanks Vishal Rana On Sun, Jun 13, 2010 at 6:04 PM, Robert Kern wrote: > On Sun, Jun 13, 2010 at 19:52, Vishal Rana wrote: > > I created a record array (from strings and floats) with

[Numpy-discussion] Serializing numpy record array

2010-06-13 Thread Vishal Rana
ntu 10.04 it fails. Looks like serialization is failing for type numpy.float64. Is the any work around, I was trying to set dtype=object is that ok? Also how can I set same dtype (for eg. object) for all a, b, and c? Thanks Vishal Rana ___ NumPy-Discussion

Re: [Numpy-discussion] How do I get element on axis 1

2010-04-02 Thread Vishal Rana
Thanks Warren! On Fri, Apr 2, 2010 at 2:46 PM, Warren Weckesser < warren.weckes...@enthought.com> wrote: > Vishal Rana wrote: > > Hi, > > > > I know its easy, but I am not just getting it... > > > > How do I get last element on axis=1 for: > > > &

[Numpy-discussion] How do I get element on axis 1

2010-04-02 Thread Vishal Rana
Hi, I know its easy, but I am not just getting it... How do I get last element on axis=1 for: a = array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) Expected: array([4, 9, 14, 19, 24]) Thanks Vishal

Re: [Numpy-discussion] Applying formula to all in an array which hasvalue from previous

2010-04-02 Thread Vishal Rana
I get AttributeError: 'NoneType' object has no attribute 'accumulate' for the call vecfun.ufunc.accumulate(np.array([0, 1, 2, 3])) It works fine if I make a dummy call to vecfun before! Any idea for this behavior? Thanks Vishal Rana On Mon, Mar 29, 2010 at 4:07 AM, Nadav

Re: [Numpy-discussion] Can this be done more efficiently using numpy?

2010-04-01 Thread Vishal Rana
Thanks Didrik! On Thu, Apr 1, 2010 at 1:21 AM, Didrik Pinte wrote: > On Wed, 2010-03-31 at 23:13 -0700, Vishal Rana wrote: > > Hi, > > > > > > A calculation which goes like this... > > > > > > n = 5 > > a = np.arange(1000) > > b = np.

[Numpy-discussion] Can this be done more efficiently using numpy?

2010-03-31 Thread Vishal Rana
if I have like 200K records! Is there a more efficient way to do this using numpy? Thanks Vishal Rana ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Replacing NANs

2010-03-30 Thread Vishal Rana
That was quick! Thanks Angus and Zachary On Tue, Mar 30, 2010 at 11:59 AM, Vishal Rana wrote: > Hi, > > In an array I want to replace all NANs with some number say 100, I found a > method* **nan_to_num *but it only replaces with zero. > Any solution for this? > *

[Numpy-discussion] Replacing NANs

2010-03-30 Thread Vishal Rana
Hi, In an array I want to replace all NANs with some number say 100, I found a method* **nan_to_num *but it only replaces with zero. Any solution for this? * *Thanks Vishal ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.or

Re: [Numpy-discussion] Applying formula to all in an array which hasvalue from previous

2010-03-29 Thread Vishal Rana
as np > > vecfun = np.vectorize(func) > > vecfun.ufunc.accumulate(array((0,1,2,3,4,5,6,7,8,9)) > > > Nadav. > > > -Original Message----- > From: numpy-discussion-boun...@scipy.org on behalf of Vishal Rana > Sent: Sun 28-Mar-10 21:19 > To: Discussion of Numeric

[Numpy-discussion] Applying formula to all in an array which has value from previous

2010-03-28 Thread Vishal Rana
Hi, For a numpy array: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) I do some calculation with 0, 1... and get a value = 2.5, now use this value to do the repeat the same calculation with next element for example... 2.5, 2 and get a value = 3.1 3.1, 3 and get a value = 4.2 4.2, 4 and get a value = 5.1

Re: [Numpy-discussion] Accessing fields of the object stored in numpy array

2010-02-18 Thread Vishal Rana
Thanks Friedrich it helped. On Thu, Feb 18, 2010 at 2:45 AM, Friedrich Romstedt < friedrichromst...@gmail.com> wrote: > Hello Vishal, > > 2010/2/18 Vishal Rana : > > > a = np.array([dt.datetime(2010, 2, 17), dt.datetime(2010, 2, 16), > > dt.datetime(2010, 2, 15)])

[Numpy-discussion] Accessing fields of the object stored in numpy array

2010-02-17 Thread Vishal Rana
]) Any pointers? Thanks Vishal Rana Joan Crawford<http://www.brainyquote.com/quotes/authors/j/joan_crawford.html> - "I, Joan Crawford, I believe in the dollar. Everything I earn, I spend." ___ NumPy-Discussion mailing list NumPy-Discussio

Re: [Numpy-discussion] Utility function to find array items are in ascending order

2010-02-09 Thread Vishal Rana
Thanks On Tue, Feb 9, 2010 at 7:51 AM, Brent Pedersen wrote: > On Tue, Feb 9, 2010 at 7:42 AM, Vishal Rana wrote: > > Hi, > > Is there any utility function to find if values in the array are in > > ascending or descending order. > > Example: > > arr = [1, 2,

[Numpy-discussion] Utility function to find array items are in ascending order

2010-02-09 Thread Vishal Rana
Hi, Is there any utility function to find if values in the array are in ascending or descending order. Example: arr = [1, 2, 4, 6] should return true arr2 = [1, 0, 2, -2] should return false Thanks Vishal ___ NumPy-Discussion mailing list NumPy-Discuss

Re: [Numpy-discussion] Efficiently converting numpy record array to a list of dictionary

2010-02-04 Thread Vishal Rana
naries: > > In [6]: import numpy as np > > In [7]: dt = np.dtype([('name', 'S30'),('age',int),('weight',float)]) > > In [8]: r = np.array([('Bill',31, 260.0), ('Fred', 15, 145.0)], dtype=dt) > > In [9]: r[0]['name

Re: [Numpy-discussion] Efficiently converting numpy record array to a list of dictionary

2010-02-04 Thread Vishal Rana
Thanks Robert :) Vishal Rana Samuel Goldwyn<http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html> - "I don't think anyone should write their autobiography until after they're dead." On Thu, Feb 4, 2010 at 4:04 PM, Robert Kern wrote: > On Thu, Feb 4, 2010

[Numpy-discussion] Efficiently converting numpy record array to a list of dictionary

2010-02-04 Thread Vishal Rana
How do I convert the numpy record array below: recs = [('Bill', 31, 260.0), ('Fred', 15, 145.0)] r = rec.fromrecords(recs, names='name, age, weight', formats='S30, i2, f4') to a list of dictionary like: [{'name': 'Bill', 'age': 31, 'weight': 260.0}, 'name': 'Fred', 'age': 15, 'weight': 145.0}] _