5 ms·
read_sql_query queries an actual database, this library allows you to query from the dataframes in your current locals as if they where database tables. my
by filmor 10y ago
read_sql_query queries an actual database, this library allows you to query from the dataframes in your current locals as if they where database tables.
my_df = pd.DataFrame(...)
queried_df = pysqldf("select * from my_df where col = 1")
Looks useful :)
EDIT: Actually, looking at the code, it loads your dataframes into SQLite memory tables and uses to_sql and from_sql under the hood to query from there.
- aw3c2 10y agoDoes this mean it is limited to my RAM size?
- IndianAstronaut 10y agoYes. Pandas is still constrained by memory.
- aw3c2 10y agoI think the HDF support is good enough to count as larger-than-memory.
- sevensor 10y agoYes, it looks like your data gets loaded into a SQLite DB while being retained in the ndarray-based data frame.
- alexpetralia 10y agoI'm not sure why you'd use SQL to query a pandas dataframe when you could just use the actual pandas functions. As far as I know, pandas functionality is way more powerful than SQL, so I don't know why you'd want to limit yourself to just SQL.