Skip to content

Commit e7c9475

Browse files
committed
fix plotly#2279: add pandas as dependency of plotly[express] extra
1 parent 00c18fd commit e7c9475

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Diff for: doc/python/plotly-express.md

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jupyter:
3838

3939
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.
4040

41+
Unlike Plotly itself, Plotly Express requires Pandas to be installed. If desired this dependency can be made explicit by installing/depending on `plotly[express]`.
42+
4143
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.*
4244

4345
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/):

Diff for: packages/python/plotly/plotly/express/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
if pd is None:
1010
raise ImportError(
1111
"""\
12-
Plotly express requires pandas to be installed."""
12+
Plotly express requires pandas to be installed. Install on plotly[express] to create a dependency on pandas.
13+
"""
1314
)
1415

1516
from ._imshow import imshow

Diff for: packages/python/plotly/setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,9 @@ def run(self):
554554
("etc/jupyter/nbconfig/notebook.d", ["jupyterlab-plotly.json"]),
555555
],
556556
install_requires=["tenacity>=6.2.0"],
557+
extras_require={
558+
"express": ["pandas>=1.5.0"],
559+
},
557560
zip_safe=False,
558561
cmdclass=dict(
559562
build_py=js_prerelease(versioneer_cmds["build_py"]),

0 commit comments

Comments
 (0)