Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > numpy arrays to python compatible arrays

Reply
Thread Tools

numpy arrays to python compatible arrays

 
 
Javier Montoya
Guest
Posts: n/a
 
      06-10-2010
Dear all,

I'm new to python and have been working with the numpy package. I have
some numpy float arrays (obtained from np.fromfile and np.cov
functions) and would like to convert them to simple python arrays.
I was wondering which is the best way to do that? Is there any
function to do that?

Best wishes
 
Reply With Quote
 
 
 
 
Philip Semanchuk
Guest
Posts: n/a
 
      06-10-2010

On Jun 10, 2010, at 9:58 AM, Javier Montoya wrote:

> Dear all,
>
> I'm new to python and have been working with the numpy package. I have
> some numpy float arrays (obtained from np.fromfile and np.cov
> functions) and would like to convert them to simple python arrays.
> I was wondering which is the best way to do that? Is there any
> function to do that?


Hi Javier,
Since you are new to Python I'll ask whether you want to convert Numpy
arrays to Python arrays (as you stated) or Python lists. Python lists
are used very frequently; Python arrays see very little use outside of
numpy.

If you can use a Python list, the .tolist() member of the numpy array
object should do the trick.

bye
P

 
Reply With Quote
 
 
 
 
Martin
Guest
Posts: n/a
 
      06-10-2010
On Jun 10, 9:02*pm, Philip Semanchuk <(E-Mail Removed)> wrote:
> On Jun 10, 2010, at 9:58 AM, Javier Montoya wrote:
>
> > Dear all,

>
> > I'm new to python and have been working with the numpy package. I have
> > some numpy float arrays (obtained from np.fromfile and np.cov
> > functions) and would like to convert them to simple python arrays.
> > I was wondering which is the best way to do that? Is there any
> > function to do that?

>
> Hi Javier,
> Since you are new to Python I'll ask whether you want to convert Numpy *
> arrays to Python arrays (as you stated) or Python lists. Python lists *
> are used very frequently; Python arrays see very little use outside of *
> numpy.
>
> If you can use a Python list, the .tolist() member of the numpy array *
> object should do the trick.
>
> bye
> P


as Philip said...though I very much doubt you really want to do this?
Why wouldn't you just keep it in a numpy array?
 
Reply With Quote
 
Javier Montoya
Guest
Posts: n/a
 
      06-12-2010
On Jun 11, 12:29*am, Martin <(E-Mail Removed)> wrote:
> On Jun 10, 9:02*pm, Philip Semanchuk <(E-Mail Removed)> wrote:
>
>
>
> > On Jun 10, 2010, at 9:58 AM,JavierMontoyawrote:

>
> > > Dear all,

>
> > > I'm new to python and have been working with the numpy package. I have
> > > some numpy float arrays (obtained from np.fromfile and np.cov
> > > functions) and would like to convert them to simple python arrays.
> > > I was wondering which is the best way to do that? Is there any
> > > function to do that?

>
> > HiJavier,
> > Since you are new to Python I'll ask whether you want to convert Numpy *
> > arrays to Python arrays (as you stated) or Python lists. Python lists *
> > are used very frequently; Python arrays see very little use outside of *
> > numpy.

>
> > If you can use a Python list, the .tolist() member of the numpy array *
> > object should do the trick.

>
> > bye
> > P

>
> as Philip said...though I very much doubt you really want to do this?
> Why wouldn't you just keep it in a numpy array?


Thanks for the suggestions! The main reason not to use a numpy array
is because I'm
using a package that doesn't work with numpy arrays.
With the .tolist() conversion it's now working fine, thanks!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing numpy over an older numpy Tom Kacvinsky Python 1 06-15-2012 07:15 PM
A More Concise Description of Numpy than the Guide to Numpy? W. eWatson Python 2 11-23-2009 08:58 PM
NumPy Question - numpy.put in multi-dimensional array Bryan.Fodness@gmail.com Python 2 11-13-2007 10:36 PM
numpy migration (also posted to numpy-discussion) Duncan Smith Python 3 04-25-2007 01:36 AM
Trouble with numpy-0.9.4 and numpy-0.9.5 drife Python 1 03-01-2006 05:59 PM



Advertisments