Enhance pandas DataFrame with direct Plotly Express plotting functions
Project description
plotlyplus
Introduction
plotlyplus
is a Python module that simplify the calling of plotly.express function. In standard way, one needs to do the following to create a plot using plotly.express based on a dataframe, df, you need to do the following
import pandas as pd
import plotly.express as px
px.scatter(df, x='namex',y='namey')
The plotlyplus package add the plotly.express plotting methods to the pandas dataframe class. This will simply the call to the plotting function as:
from plotlyplus.plotlyplus import *
df.scatter(x='namex',y='namey')
This is a small and almost trivial tweak, but brings a lot of convenience in daily practical work. Enjoy!
Key Features
- Better integration of plotly.express functions to pandas dataframe: Directly integrates Plotly Express plotting functions with pandas DataFrames.
- Safe mode: To avoid naming conflicts,
plotlyplus
introduces a 'safe mode' (plotlyplus_safe
). In this mode, each plotly.express function is prefixed with `px_``, ensuring namespace integrity at the cost of slightly reduced convenience.
Installation
Install PlotlyPlus
using pip with the following command:
pip install plotlyplus
Usage
Standard Mode
All plotly.express fundtions become methods of pandas dataframe.
from plotlyplus.plotlyplus import *
df = pd.DataFrame(...)
fig = df.bar(...) # Plotly Express function as a DataFrame method
fig.show()
Safe Mode
This mode prefixes the Plotly Express functions with px_
to minimize namespace conflicts.
from plotlyplus.plotlyplus_safe import *
df = pd.DataFrame(...)
fig = df.px_bar(...) # Plotly Express function as a DataFrame method
fig.show()
Contributing
Contributions to PlotlyPlus are welcome. Please feel free to submit pull requests, report bugs, or suggest features.
License
PlotlyPlus is made available under the MIT License.
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
Built Distribution
Hashes for plotlyplus-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0af70a896119436de46891be8b893c1c68aa75a6e204754229449959a39cc0cd |
|
MD5 | 776b66029e62f0177b5556d9b4890a83 |
|
BLAKE2b-256 | 4d88b21842699c9d92f4a900797c32f5bf6d8e2d050cd3849492bbabfc88d83b |