Skip to content

Commit

Permalink
Merge pull request #4103 from kaibir/master
Browse files Browse the repository at this point in the history
Pandas 2 compability: Fix a bug regarding timedelta64[ms] representation #4102
  • Loading branch information
alexcjohnson authored Apr 5, 2023
2 parents 743b524 + 67e9628 commit cb27da7
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def color_validator(request):
"uint16",
"uint32",
"uint64",
"float16",
# "float16",
"float32",
"float64",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def color_validator(request):
"uint16",
"uint32",
"uint64",
"float16",
# "float16",
"float32",
"float64",
]
Expand Down
3 changes: 2 additions & 1 deletion packages/python/plotly/plotly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 3 additions & 1 deletion packages/python/plotly/plotly/express/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cb27da7

Please sign in to comment.