I would very muck have a db().select_as_pandas(....) that avoids parsing the database response a puts the tuples representing the rows directly in DB. If nobody beats me on the time, I may get it done next week.
Massimo On Friday, 4 May 2018 08:26:35 UTC-5, Richard wrote: > > By include in pandas I mean add support to pydal in pandas so you can do > something like : > > df = pd.DataFrame.from_pydal(db(...).select(...)) > > Richard > > On Fri, May 4, 2018 at 1:10 AM, Jurgis Pralgauskis < > [email protected]> wrote: > >> I'd like not to include sth into Pandas, but to adapt Pandas syntax for >> DAL (SELECT part mostly, in my case) :) >> >> -- >> Jurgis Pralgauskis >> tel: 8-616 77613 >> >> 2018-05-03 04:05 popiet "Richard Vézina" <[email protected]> >> rašė: >> >> I use this to merge join dal query : >> >> # merge_dicts is from here : >> # >> http://stackoverflow.com/questions/38987/how-can-i-merge-two-python-dictionaries-in-a-single-expression >> def merge_dicts(*dict_args): >> """ >> Given any number of dicts, shallow copy and merge into a new dict, >> precedence goes to key value pairs in latter dicts. >> """ >> result = {} >> for dictionary in dict_args: >> result.update(dictionary) >> return result >> >> db(db.table_1.id == something).select(db.table_1.ALL, db.table_2.ALL, >> db.table_3.ALL, db.table_4.ALL, join or left=[...]).as_list() >> >> df = pd.DataFrame([merge_dicts(r['table_1'], >> r['table_2'], >> r['table_3'], >> r[table_4]) for r in >> rows.as_list()]) >> >> What you want would have to be include in pandas. >> >> Richard >> >> On Thu, May 3, 2018 at 2:49 AM, Jurgis Pralgauskis < >> [email protected]> wrote: >> >>> Bt if I want select cols/filter rows/aggregate/ join tables >>> - with Pandas syntax directly from DB (for it to work as DAL, not with >>> another DAL syntax) ? >>> >>> -- >>> Jurgis Pralgauskis >>> tel: 8-616 77613 >>> >>> 2018-05-02, tr 22:22, Richard Vézina <[email protected]> rašė: >>> >>>> I am not sure I understand what you want... >>>> >>>> It a nice thing if Pandas use RAM it means that it use the fastest >>>> component of you computer... It should make Pandas fast... >>>> >>>> I am not sure what would involve overloading operators to use pyDAL... >>>> Pandas is used to transform data... If what you do on your dataframe has >>>> to >>>> be apply to your data would be really risky on the persistence stand >>>> point... >>>> >>>> To populate dataframe from web2py table : >>>> >>>> import pandas as pd >>>> rows = db(db.auth_user.id > 0).select(db.auth_user.ALL).as_list() >>>> df = pd.DataFrame(rows) >>>> df.columns # Should be your fields names >>>> >>>> Richard >>>> >>>> On Tue, May 1, 2018 at 11:31 PM, Jurgis Pralgauskis < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> Pandas syntax seems very nice (short), and popular ... >>>>> But Pandas eat RAM..., and well, most of data is in DB... >>>>> >>>>> so I wonder, how hard would it be to overload operators to use pyDAL >>>>> (or other DAL/ORM)? >>>>> >>>>> what are the main challanges? >>>>> >>>>> -- >>>>> Resources: >>>>> - http://web2py.com >>>>> - http://web2py.com/book (Documentation) >>>>> - http://github.com/web2py/web2py (Source code) >>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "web2py-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "web2py-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/web2py/DIeQ5U-pr6Q/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/DIeQ5U-pr6Q/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

