diff --git a/.circleci/config.yml b/.circleci/config.yml index 81c16608bd..e77a402dc6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,6 +150,15 @@ jobs: - test_optional: py: "39" + # Pandas + + python_39_pandas_2_optional: + docker: + - image: circleci/python:3.9-buster-node-browsers + steps: + - test_optional: + py: "39_pandas_2" + # Orca python_38_orca: docker: @@ -470,6 +479,7 @@ workflows: - python_37_optional - python_38_optional - python_39_optional + - python_39_pandas_2_optional - python_38_orca - python_37_percy - build-doc diff --git a/CHANGELOG.md b/CHANGELOG.md index 1efe6a315d..76f485ad12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [5.X.X] - 2023-MM-DD +- Support for pandas 2.0 [[#4103](https://github.com/plotly/plotly.py/pull/4103)] + ## [5.14.0] - 2023-03-29 ### Updated diff --git a/packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py b/packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py index 53e05cd7d0..ef8818181d 100644 --- a/packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py +++ b/packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py @@ -40,7 +40,7 @@ def color_validator(request): "uint16", "uint32", "uint64", - "float16", + # "float16", "float32", "float64", ] diff --git a/packages/python/plotly/_plotly_utils/tests/validators/test_xarray_input.py b/packages/python/plotly/_plotly_utils/tests/validators/test_xarray_input.py index b5a885a923..ada42342d6 100644 --- a/packages/python/plotly/_plotly_utils/tests/validators/test_xarray_input.py +++ b/packages/python/plotly/_plotly_utils/tests/validators/test_xarray_input.py @@ -40,7 +40,7 @@ def color_validator(request): "uint16", "uint32", "uint64", - "float16", + # "float16", "float32", "float64", ] diff --git a/packages/python/plotly/plotly/__init__.py b/packages/python/plotly/plotly/__init__.py index 0fce98691e..83d6aaa03e 100644 --- a/packages/python/plotly/plotly/__init__.py +++ b/packages/python/plotly/plotly/__init__.py @@ -102,7 +102,8 @@ def plot(data_frame, kind, **kwargs): if kind == "line": return line(data_frame, **kwargs) if kind == "area": - return area(data_frame, **kwargs) + new_kwargs = {k: kwargs[k] for k in kwargs if k not in ["stacked"]} + return area(data_frame, **new_kwargs) if kind == "bar": return bar(data_frame, **kwargs) if kind == "barh": diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py index a1c14ae884..39dabba635 100644 --- a/packages/python/plotly/plotly/express/_core.py +++ b/packages/python/plotly/plotly/express/_core.py @@ -1682,7 +1682,9 @@ def process_dataframe_timeline(args): ) # note that we are not adding any columns to the data frame here, so no risk of overwrite - args["data_frame"][args["x_end"]] = (x_end - x_start).astype("timedelta64[ms]") + args["data_frame"][args["x_end"]] = (x_end - x_start).astype( + "timedelta64[ns]" + ) / np.timedelta64(1, "ms") args["x"] = args["x_end"] del args["x_end"] args["base"] = args["x_start"] diff --git a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py index 1bd3325242..45f72a0fe1 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py @@ -15,7 +15,7 @@ import numpy as np import pandas as pd import pytz -from pandas.util.testing import assert_series_equal +from pandas.testing import assert_series_equal import json as _json import os import base64 diff --git a/packages/python/plotly/test_requirements/requirements_39_pandas_2_optional.txt b/packages/python/plotly/test_requirements/requirements_39_pandas_2_optional.txt new file mode 100644 index 0000000000..7132d8a634 --- /dev/null +++ b/packages/python/plotly/test_requirements/requirements_39_pandas_2_optional.txt @@ -0,0 +1,21 @@ +requests==2.25.1 +tenacity==6.2.0 +pandas==2.0.0 +numpy==1.20.3 +xarray==0.17.0 +statsmodels +Pillow==8.2.0 +pytest==6.2.3 +pytz==2021.1 +ipython[all]==7.22.0 +ipywidgets==8.0.2 +ipykernel==5.5.3 +jupyter==1.0.0 +scipy==1.6.2 +Shapely==1.7.1 +geopandas==0.9.0 +pyshp==2.1.3 +matplotlib==2.2.3 +scikit-image==0.18.1 +psutil==5.7.0 +kaleido