From: Oleksandr H. <guz...@gm...> - 2013-08-27 23:50:43
|
Hi Again: 2013/8/27 Anthony Scopatz <sc...@gm...> > Hey Sasha, > > You probably want to look at the Expr class [1] where you set "out" to be > the same as the original array. > > Be Well > Anthony > > 1. http://pytables.github.io/usersguide/libref/expr_class.html > I just wanted to make sure if it is possible to use an assignment in expressions? (this gives me a syntax error exception, complains about the equal sign in the expression) h = tb.open_file(path, mode="a") varTable = h.get_node("/", var_name) coef = 3 * 60 * 60 #output step expr = tb.Expr("c = c * m", uservars = {"c": varTable.cols.field, "m": coef }) expr.eval() varTable.flush() h.close() Is this an optimal way of multiplying a column? (this one works, but I think it loads all the data into memory...right?) expr = tb.Expr("c * m", uservars = {"c": varTable.cols.field, "m": coef }) varTable.cols.field[:] = expr.eval() Thank you Cheers > > > On Tue, Aug 27, 2013 at 11:44 AM, Oleksandr Huziy <guz...@gm...>wrote: > >> Hi All: >> >> I have a huge table imported from other binary files to hdf, and I forgot >> to multiply the data by a factor in one case. Is there an easy way to >> multiply a column by a constant factor using pytables? >> To modify it in place? >> >> Thank you >> >> -- >> Sasha >> >> >> ------------------------------------------------------------------------------ >> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> Discover the easy way to master current and previous Microsoft >> technologies >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> tutorial videos with LearnDevNow. Subscribe today and save! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> _______________________________________________ >> Pytables-users mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/pytables-users >> >> > > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > > |