Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2279: add pandas as dependency of plotly[express] extra #3913

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/python/plotly-express.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jupyter:

The `plotly.express` module (usually imported as `px`) contains functions that can create entire figures at once, and is referred to as Plotly Express or PX. Plotly Express is a built-in part of the `plotly` library, and is the recommended starting point for creating most common figures. Every Plotly Express function uses [graph objects](/python/graph-objects/) internally and returns a `plotly.graph_objects.Figure` instance. Throughout the `plotly` documentation, you will find the Plotly Express way of building figures at the top of any applicable page, followed by a section on how to use graph objects to build similar figures. Any figure created in a single function call with Plotly Express could be created using graph objects alone, but with between 5 and 100 times more code.

Unlike Plotly itself, Plotly Express requires Pandas to be installed. If desired this dependency can be made explicit by installing/depending on `plotly[express]`.

Plotly Express provides [more than 30 functions for creating different types of figures](https://plotly.com/python-api-reference/plotly.express.html). The API for these functions was carefully designed to be as consistent and easy to learn as possible, making it easy to switch from a scatter plot to a bar chart to a histogram to a sunburst chart throughout a data exploration session. *Scroll down for a gallery of Plotly Express plots, each made in a single function call.*

Here is a talk from the [SciPy 2021 conference](https://www.scipy2021.scipy.org/) that gives a good introduction to Plotly Express and [Dash](https://dash.plotly.com/):
Expand Down
3 changes: 2 additions & 1 deletion packages/python/plotly/plotly/express/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
if pd is None:
raise ImportError(
"""\
Plotly express requires pandas to be installed."""
Plotly express requires pandas to be installed. Install plotly[express] to create a dependency on pandas.
"""
)

from ._imshow import imshow
Expand Down
3 changes: 3 additions & 0 deletions packages/python/plotly/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ def run(self):
("etc/jupyter/nbconfig/notebook.d", ["jupyterlab-plotly.json"]),
],
install_requires=["tenacity>=6.2.0"],
extras_require={
"express": ["pandas>=1.5.0"],
},
zip_safe=False,
cmdclass=dict(
build_py=js_prerelease(versioneer_cmds["build_py"]),
Expand Down