Package: pandas-paddles
Pandas PaddlesAccess the callingpandasdata frame inloc[],iloc[],assign()and other methods withDFto write better chains of
data frame operations, e.g.:df=(df# Select all rows with column "x" < 2.loc[DF["x"]<2].assign(# Shift "x" by its minimum.y=DF["x"]-DF["x"].min(),# Clip "x" to it's central 50% window. Note how DF is used# in the argument to `clip()`.z=DF["x"].clip(lower=DF["x"].quantile(0.25),upper=DF["x"].quantile(0.75)),))OverviewMotivation: Make chaining Pandas operations easier and bring
functionality to Pandas similar to Spark’scol()function or referencing columns in R’sdplyr.Installfrom PyPI withpip installpandas-paddles. Pandas versions 1+ (>=1,<3) are supported.Documentationcan be found atreadthedocs.Source codecan be obtained fromGitHub.ChangelogExample: Create new column and filterInstead of writing “traditional” Pandas like this:df_in=pd.DataFrame({"x":range(5)})df=df_in.assign(y=df_in["x"]//2)df=df.loc[df["y"]<=1]df#    x  y# 0  0  0# 1  1  0# 2  2  1# 3  3  1One can write:frompandas_paddlesimportDFdf=(df_in.assign(y=DF["x"]//2).loc[DF["y"]<=1])This is especially handy when re-iterating on data frame manipulations
interactively, e.g. in a notebook (just imagine you have to renamedftodf_out).But you can access all methods and attributes of the data frame from the
context:df=pd.DataFrame({"X":range(5),"y":["1","a","c","D","e"],})df.loc[DF["y"]str.isupper()|DF["y"]str.isnumeric()]#    X  y# 0  0  1# 3  3  Ddf.loc[:,DF.columns.str.isupper()]#    X# 0  0# 1  1# 2  2# 3  3# 4  4You can even useDFin the arguments to methods:df=pd.DataFrame({"x":range(5),"y":range(2,7),})df.assign(z=DF['x'].clip(lower=2.2,upper=DF['y'].median()))#    x  y    z# 0  0  2  2.2# 1  1  3  2.2# 2  2  4  2.2# 3  3  5  3.0# 4  4  6  4.0When working with~pd.SeriestheSobject exists. It can be used
similar toDF:s=pd.Series(range(5))s[s<3]# 0    0# 1    1# 2    2# dtype: int64Similar projects for pandassiuba(+) active(-) new API to learnpandas-ply(-) stale(?), last change 6 years ago(-) new API to learn(-)Symbol/pandas_ply.Xworks only withply_*functionspandas-select(+) no explicitedfnecessary(-) new API to learnpandas-selectable(+) simpleselectaccessor(-) usage inside chains clumsy (needs explicitedf):((df.select.A=='a').select.B=='b')(-) hard-codedstr,dtaccessor methods(?) composable?DevelopmentDevelopment is containerized with [Docker](https://www.docker.com/) to
separte from host systems and improve reproducability. No other
prerequisites are needed on the host system.Recommendation for Windows users:installWSL 2(tested
on Ubuntu 20.04), and for containerized workflows,Docker
Desktopfor Windows.Thecommon tasksare collected inMakefile(Seemake helpfor a
complete list):Run the unit tests:make testormake watchfor continuously running
tests on code-changes.Build the documentation:make docsTODO: Update thepoetry.lockfile:make lockAdd a dependency:Start a shell in a new container.Add dependency withpoetry addin the running container. This will updatepoetry.lockautomatically:# 1. On the host system
% make shell
# 2. In the container instance:
I have no name!@7d0e85b3a303:/app$ poetry add --dev --lock falconBuild the development imagemake devimage(Note: This should be done automatically for the targets.)