Skip to main content

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 with pandas.

    import pandas as pd
    import pandas_shortcuts
    
  • Every pd.DataFrame and pd.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's numba and llvmlite) do not support Python 3.9 as of pandas_shortcuts v0.0.1
  • df.v() directly generates IPython.core.display.HTML object under the hood, thus completely bypassing any pd.set_option("display.max_rows", ...) and pd.set_option("display.max_columns", ...) that the user may have specified.

Project details


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)

Uploaded Source

Built Distribution

pandas_shortcuts-0.0.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page