Why even wait for autocompletion when you can use `pandas_shortcuts`?
Project description
pandas-shortcuts
Why even wait for autocompletion when you can use pandas_shortcuts
?
How to use
-
Simply import
pandas_shortcuts
together withpandas
.import pandas as pd import pandas_shortcuts
-
Every
pd.DataFrame
andpd.Series
objects will have:- shortcuts (full list below)
# shortcut for `df.head()` df.h() # shortcut for df.columns df.c # shortcut for df["col"].unique() df["col"].u()
- new methods (full list below)
# view up to `r` rows and `c` columns of a dataframe, overiding pandas' default limit df.v() # default r=50, c=50 # view up to `r` rows of a series, overiding pandas' default limit df["col"].v(100) # stylize a dataframe's numeric columns as heatmap or bars # view up to `r` rows and `c` of a dataframe, overiding pandas' default limit df.sh() # style=heatmap df.sb() # style=bar # call `dtale.show`, refer to dtale docs for details df.dt() # call `pandas_profiling.ProfileReport`, refer to pandas_profiling docs for details df.pp()
Available Shortcuts and Methods
# Heads or tails
df.h(...) # df.head(...)
df.t(...) # df.tail(...)
df["col"].h(...) # df["col"].head(...)
df["col"].t(...) # df["col"].tail(...)
# Sort
df.si(...) # df.sort_index(...)
df["col"].si(...) # df["col"].sort_index(...)
df.sv(...) # df.sort_values(...)
df["col"].sv(...) # df["col"].sort_values(...)
# Index
df.sx(...) # df.set_index(...)
df.rx(...) # df.reset_index(...)
df["col"].rx(...) # df["col"].reset_index(...)
# Groupby
df.gb(...) # df.groupby(...)
df["col"].gb(...) # df["col"].groupby(...)
# Duplicates
df.dd(...) # df.drop_duplicates(...)
df["col"].dd(...) # df["col"].drop_duplicates(...)
df.dup(...) # df.duplicated(...)
df["col"].dup(...) # df["col"].duplicated(...)
df["col"].u(...) # df["col"].unique(...)
# Properties
df.c # df.columns
df.i # df.index
df["col"].i # df["col"].index
# Methods
df.v(...)
df["col"].v(...)
df.sh(...)
df.sb(...)
df.dt(...)
df.pp(...)
Note
- Some dependencies (
pandas_profiling
'snumba
andllvmlite
) do not support Python 3.9 as ofpandas_shortcuts
v0.0.1 df.v()
directly generatesIPython.core.display.HTML
object under the hood, thus completely bypassing anypd.set_option("display.max_rows", ...)
andpd.set_option("display.max_columns", ...)
that the user may have specified.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pandas_shortcuts-0.0.1.tar.gz
(4.9 kB
view hashes)
Built Distribution
Close
Hashes for pandas_shortcuts-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a915a23219f38d9fbc0e6df61c2c9356fa3c11ac0fbae4bfb48705bd86d8d2a |
|
MD5 | 289ac4e935241887d513d4813c9abf1f |
|
BLAKE2b-256 | 2c6c42dc024f6640083a9f2588541eb7fee414143d4e02e1d37f5a3e77160d8e |