Anthony, Uemit Your answers were really usefull. Both options improve the time compared to the previous one. Now the program is just taking to run only 4% of the time compared to the previous code.
Many thanks! German Message: 5 Date: Mon, 20 Feb 2012 10:43:27 -0600 From: Anthony Scopatz <scop...@gmail.com> Subject: Re: [Pytables-users] Question about reading a complete table. To: Discussion list for PyTables <pytables-users@lists.sourceforge.net> Message-ID: <capk-6t7jwetnffc97yhet3xuxfuqrp1xxj3le-agan-y_za...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Hello German, The easiest and probably the fastest way is to use numpy array. Simply pass the table into the array constructor: import numpy as np a = np.array(f.root.path.to.table) If your table contains more than one type and you want to keep that setup via a structured array, also pass in the dtype: a = np.array(f.root.path.to.table, f.root.path.to.table.dtype) Be Well Anthony On Mon, Feb 20, 2012 at 4:57 AM, German Ocampo <geroca...@gmail.com> wrote: > Good morning > > Im new in Pytables and I have a simple question, please help me. > > I have a pytable created with four Float() columns, the number of rows > in the table is around 500.000. I need to read all the complete table > in fastest way possible to a numpy array in memory. Im using the > following command: > > total =[ (x['col1'],x['col2'],x['col3'],x['col4'],) for x in > row_relational] > > Question: Is there another command that allows to read in a fastest way? > > Many thanks > > German > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Pytables-users mailing list > Pytables-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pytables-users > -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 6 Date: Mon, 20 Feb 2012 18:15:57 +0100 From: ?mit Seren <uemit.se...@gmail.com> Subject: Re: [Pytables-users] Question about reading a complete table. To: Discussion list for PyTables <pytables-users@lists.sourceforge.net> Message-ID: <canbyw4b26zmkf0olb8pxj+kdmnxyq0gs9nwfnkcrcrq7p4m...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 I guess using the slice operator on the table should probably also load the entire table into memory: a = f.root.path.to.table[:] This will return a structured array tough. On Mon, Feb 20, 2012 at 5:43 PM, Anthony Scopatz <scop...@gmail.com> wrote: > Hello German, > > The easiest and probably the fastest way is to use numpy array. > Simply pass the table into the array constructor: > > import numpy as np > a = np.array(f.root.path.to.table) > > If your table contains more than one type and you want to keep that > setup via a structured array, also pass in the dtype: > > a = np.array(f.root.path.to.table, f.root.path.to.table.dtype) > > Be Well > Anthony > > > On Mon, Feb 20, 2012 at 4:57 AM, German Ocampo <geroca...@gmail.com> wrote: >> >> Good morning >> >> Im new in Pytables and I have a simple question, please help me. >> >> I have a pytable created with four Float() columns, the number of rows >> in the table is around 500.000. I need to read all the complete table >> in fastest way possible to a numpy array in memory. ?Im using the >> following command: >> >> ? total =[ (x['col1'],x['col2'],x['col3'],x['col4'],) for x in >> row_relational] >> >> Question: Is there another command that allows to read in a fastest way? >> >> Many thanks >> >> German >> >> >> ------------------------------------------------------------------------------ >> Try before you buy = See our experts in action! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-dev2 >> _______________________________________________ >> Pytables-users mailing list >> Pytables-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/pytables-users > > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Pytables-users mailing list > Pytables-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pytables-users > ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users