Skip to content

Commit cb27da7

Browse files
authored
Merge pull request #4103 from kaibir/master
Pandas 2 compability: Fix a bug regarding timedelta64[ms] representation #4102
2 parents 743b524 + 67e9628 commit cb27da7

File tree

8 files changed

+42
-5
lines changed

8 files changed

+42
-5
lines changed

Diff for: .circleci/config.yml

+10
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ jobs:
150150
- test_optional:
151151
py: "39"
152152

153+
# Pandas
154+
155+
python_39_pandas_2_optional:
156+
docker:
157+
- image: circleci/python:3.9-buster-node-browsers
158+
steps:
159+
- test_optional:
160+
py: "39_pandas_2"
161+
153162
# Orca
154163
python_38_orca:
155164
docker:
@@ -470,6 +479,7 @@ workflows:
470479
- python_37_optional
471480
- python_38_optional
472481
- python_39_optional
482+
- python_39_pandas_2_optional
473483
- python_38_orca
474484
- python_37_percy
475485
- build-doc

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [5.X.X] - 2023-MM-DD
6+
- Support for pandas 2.0 [[#4103](https://github.com/plotly/plotly.py/pull/4103)]
7+
58
## [5.14.0] - 2023-03-29
69

710
### Updated

Diff for: packages/python/plotly/_plotly_utils/tests/validators/test_pandas_series_input.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def color_validator(request):
4040
"uint16",
4141
"uint32",
4242
"uint64",
43-
"float16",
43+
# "float16",
4444
"float32",
4545
"float64",
4646
]

Diff for: packages/python/plotly/_plotly_utils/tests/validators/test_xarray_input.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def color_validator(request):
4040
"uint16",
4141
"uint32",
4242
"uint64",
43-
"float16",
43+
# "float16",
4444
"float32",
4545
"float64",
4646
]

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def plot(data_frame, kind, **kwargs):
102102
if kind == "line":
103103
return line(data_frame, **kwargs)
104104
if kind == "area":
105-
return area(data_frame, **kwargs)
105+
new_kwargs = {k: kwargs[k] for k in kwargs if k not in ["stacked"]}
106+
return area(data_frame, **new_kwargs)
106107
if kind == "bar":
107108
return bar(data_frame, **kwargs)
108109
if kind == "barh":

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,9 @@ def process_dataframe_timeline(args):
16821682
)
16831683

16841684
# note that we are not adding any columns to the data frame here, so no risk of overwrite
1685-
args["data_frame"][args["x_end"]] = (x_end - x_start).astype("timedelta64[ms]")
1685+
args["data_frame"][args["x_end"]] = (x_end - x_start).astype(
1686+
"timedelta64[ns]"
1687+
) / np.timedelta64(1, "ms")
16861688
args["x"] = args["x_end"]
16871689
del args["x_end"]
16881690
args["base"] = args["x_start"]

Diff for: packages/python/plotly/plotly/tests/test_optional/test_utils/test_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import numpy as np
1616
import pandas as pd
1717
import pytz
18-
from pandas.util.testing import assert_series_equal
18+
from pandas.testing import assert_series_equal
1919
import json as _json
2020
import os
2121
import base64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
requests==2.25.1
2+
tenacity==6.2.0
3+
pandas==2.0.0
4+
numpy==1.20.3
5+
xarray==0.17.0
6+
statsmodels
7+
Pillow==8.2.0
8+
pytest==6.2.3
9+
pytz==2021.1
10+
ipython[all]==7.22.0
11+
ipywidgets==8.0.2
12+
ipykernel==5.5.3
13+
jupyter==1.0.0
14+
scipy==1.6.2
15+
Shapely==1.7.1
16+
geopandas==0.9.0
17+
pyshp==2.1.3
18+
matplotlib==2.2.3
19+
scikit-image==0.18.1
20+
psutil==5.7.0
21+
kaleido

0 commit comments

Comments
 (0)