Skip to content

Commit bdf61e7

Browse files
Merge pull request #4011 from m-ad/fix-datetime-trendline
Fix trendlines for datetimes (#3683)
2 parents 5afac75 + 665ab1d commit bdf61e7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1313
this feature was anonymously sponsored: thank you to our sponsor!
1414
- Add `marker.cornerradius` attribute to `treemap` trace [[#6351](https://github.com/plotly/plotly.js/pull/6351)]
1515
### Fixed
16-
- Fixed the usage of sume deprecated NumPy types which were removed in NumPy 1.24 [[#3997](https://github.com/plotly/plotly.py/pull/3997)]
16+
- Fixed the usage of some deprecated NumPy types which were removed in NumPy 1.24 [[#3997](https://github.com/plotly/plotly.py/pull/3997)]
17+
- Fixed bug for trendlines with datetime axes [[#3683](https://github.com/plotly/plotly.py/issues/3683)]
1718

1819
## [5.11.0] - 2022-10-27
1920

packages/python/plotly/plotly/express/_core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
328328
x = sorted_trace_data[args["x"]].values
329329

330330
if x.dtype.type == np.datetime64:
331-
x = x.astype(int) / 10**9 # convert to unix epoch seconds
331+
x = x.astype(np.int64) / 10**9 # convert to unix epoch seconds
332332
elif x.dtype.type == np.object_:
333333
try:
334334
x = x.astype(np.float64)

0 commit comments

Comments
 (0)