Install is easy via pip install sqwrl
.
import pandas as pd
from sqwrl import DB
db = DB('sqlite:///:memory:')
df = pd.DataFrame({"x": [1,2,3,4,5], "y": list("abcdf"), "z": [1.0, 1.5, 1.5, 1.2, 1.3]}).set_index("y")
ans_df = pd.read_csv("tests/anscombe.csv")
db["anscombe"] = ans_df
ans_tbl = db["anscombe"]
ans_tbl
Now you can (mostly) use the sqwrl table object as if it were a pandas dataframe!
ans_tbl[ans_tbl["dataset"].isin(["I", "II"])][["x", "y"]]
Use the .df
attribute on sqwrl table objects to read their output into pandas DataFrames for any unsupported features.
>>> (ans_tbl.df == ans_df).all().all()
True
See usage for more usage examples.
- Smart Pandas like wheres using getitem
-
.loc
operations - Indexing (including reset_index, drops, and appending)
- Sorting
- Most arithmetic operations lazily pushed
- Metadata like length and dtypes
- Groupby
- Groupby group iteration
- Groupby aggregation
- Groupby aggregation over multiple columns
- Groupby group sizes
- Groupby transform and apply
- Joins
- Pandas-style joins (have the basic framework in place for this)
- Mutation
- Adding, deleting, and editing columns
- Appending existing tables
- Deleting or editing based on conditions