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, overriding pandas' default limit
    df.v()  # default r=50, c=50
    
    # view up to `r` rows of a series, overriding 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, overriding pandas' default limit
    df.sh()  # style=heatmap
    df.sb()  # style=bar
    

Note

  • 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.

Available Shortcuts and Methods

Top Level API
pd.df # pd.DataFrame

# IO
pd.csv # pd.read_csv
pd.json # pd.read_json
pd.parquet # pd.read_parquet
pd.sql # pd.read_sql
pd.xlsx # pd.read_excel


# General function - Pivot
pd.pv # pd.pivot
pd.pvt # pd.pivot_table


# General function - datetime
pd.tdt # pd.to_datetime
pd.ttd # pd.to_timedelta
Dataframe API
# Reindexing / selection / label manipulation

df.f2 # df.rename

## Heads or tails
df.h # df.head
df.t # df.tail

## Duplicates
df.dd # df.drop_duplicates
df.dup # df.duplicated

## Index
df.sx # df.set_index
df.rx # df.reset_index

# Reshaping, Sorting, Transposing

## Sort
df.si # df.sort_index
df.sv # df.sort_values

## Pivot
df.pv # df.pivot
df.pvt # df.pivot_table

# Groupby
df.gb # df.groupby

# Missing data handling
df.dna # df.dropna
df.fna # df.fillna

# Computations / descriptive stats
df.desc # df.describe
df.vc # df.cv # df.value_counts
df.nu # df.nunique

# Properties
df.c # df.columns
df.i # df.index

# IO
df.cb # df.to_clipboard
df.dict # df.to_dict
df.np # df.to_numpy

## File types
df.csv # df.to_csv
df.html # df.to_html
df.json # df.to_json
df.md # df.to_markdown
df.parquet # df.to_parquet
df.xlsx # df.to_excel
Series API
# Reindexing / selection / label manipulation

## Heads or tails
df["col"].h # df["col"].head
df["col"].t # df["col"].tail

## Duplicates
df["col"].dd # df["col"].drop_duplicates
df["col"].dup # df["col"].duplicated

## Index
df["col"].rx # df["col"].reset_index

# Reshaping, Sorting, Transposing

## Sort
df["col"].si # df["col"].sort_index
df["col"].sv # df["col"].sort_values

# Groupby
df["col"].gb # df["col"].groupby

# Missing data handling
df["col"].dna # df["col"].dropna
df["col"].fna # df["col"].fillna

# Computations / descriptive stats
df["col"].vc # df["col"].cv # df["col"].value_counts
df["col"].nu # df["col"].nunique
df["col"].u # df["col"].unique

# Properties
df["col"].i # df["col"].index

# IO
df["col"].cb # df["col"].to_clipboard
df["col"].dict # df["col"].to_dict
df["col"].list # df["col"].to_list
df["col"].np # df["col"].to_numpy

## File types
df["col"].csv # df["col"].to_csv
df["col"].json # df["col"].to_json
df["col"].md # df["col"].to_markdown
df["col"].xlsx # df["col"].to_excel
Methods
df.sh # style_heatmap
df.sb # style_bar
df.v # dataframe_view
df["col"].v # series_view

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.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

pandas_shortcuts-0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pandas_shortcuts-0.1.tar.gz.

File metadata

  • Download URL: pandas_shortcuts-0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for pandas_shortcuts-0.1.tar.gz
Algorithm Hash digest
SHA256 a3d739a97808240305d7d9882b00b32800828dd1eaa53a3e86438c31e0d176a5
MD5 9ee29ef5c0043da75d9551f11be291b1
BLAKE2b-256 c9abba0145b04640b4aabbba5388e0d37806c1ec12c73c1c2ff5d34251a4e238

See more details on using hashes here.

File details

Details for the file pandas_shortcuts-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pandas_shortcuts-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f66466a38c0553293321162d4f2e650246696dcc6336aaed1fb5e3afff5df2bf
MD5 273497e49f0271bfc7db14a2ce46e4c0
BLAKE2b-256 19209f270bbe41b34b9294189497037055cae9e470ce7dd3c4ce40182fb7b896

See more details on using hashes here.

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