site address:
github.com/plotly/plotly.py/issues/5864 redirected to: github.com/plotly/plotly.py/issues/5864
site title:
[BUG]: Timezone-aware pandas DatetimeIndex as x makes figure creation and to_json() ~30x slower · Issue #5864 · plotly/plotly.py · GitHub
|
|
|
Our opinion (on Wednesday 18 November 2026 7:22:28 UTC):
- no comments
|
|
|
|
After content analysis of this website we propose the following hashtags:
|
|
|
|
Meta tags:
description= Description Plotting a timeseries the usual way, go.Scatter(x=series.index, y=series), is very slow if the index is a timezone-aware pd.DatetimeIndex. For 100,000 points, go.Figure(...) plus fig.to_json() takes about 2.3 s. With the same...;
Headings (most frequently used words):
navigation, description, metadata, footer, commented, on, nov, 2026, bug, timezone, aware, pandas, datetimeindex, as, makes, figure, creation, and, to_json, 30x, slower, 5864, menu, repository, activity, issue, actions, screenshots, video, steps, to, reproduce, notes, marcogorelli, koolade85, assignees, labels, type, projects, milestone, relationships, development, cause, expected, behavior, possible, fix, related, disclaimer,
Text of the page (most frequently used words):
and (29), the (28), index (21), aware (20), series (19), plotly (18), for (17), figure (17), timezone (17), #to_json (15), github (14), pandas (14), datetimeindex (14), time (12), with (12), that (10), this (9), dtype (9), not (8), 2026 (8), none (8), code (8), something (7), nov (7), object (7), naive (7), datetime64 (7), issue (6), actions (6), broken (6), bug (6), backlog (6), one (6), narwhals (6), array (6), import (6), security (5), copilot (5), sign (5), your (5), would (5), indexes (5), json (5), you (4), open (4), like (4), all (4), engine (4), path (4), down (4), copy (4), bench (4), fig (4), about (4), creation (4), support (4), navigation (3), projects (3), size (3), more (3), true (3), local (3), displayed (3), deep (3), but (3), still (3), timestamps (3), slows (3), tz_localize (3), same (3), from_native (3), utc (3), offset (3), what (3), timestamp (3), perf_counter (3), link (3), 5864 (3), makes (3), 30x (3), slower (3), quality (3), another (3), tab (3), window (3), refresh (3), session (3), reload (3), developers (3), changelog (3), customer (3), enterprise (3), grade (3), features (3), build (3), community (2), status (2), footer (2), pull (2), requests (2), development (2), milestone (2), type (2), labels (2), metadata (2), comment (2), have (2), added (2), thanks (2), team (2), will (2), take (2), contributor (2), koolade85 (2), commented (2), doesn (2), fix (2), remove (2), zone (2), numpy (2), are (2), marcogorelli (2), stewit (2), personally (2), figures (2), without (2), copying (2), them (2), add (2), switched (2), fast (2), usage (2), generation (2), closed (2), measured (2), 4250 (2), then (2), to_series (2), before (2), 038 (2), copy_to_readonly_numpy_array (2), change (2), which (2), replace_time_zone (2), 2024 (2), every (2), again (2), calls (2), auto (2), 042 (2), 008 (2), pio (2), __version__ (2), print (2), data (2), label (2), scatter (2), was (2), slow (2), takes (2), description (2), 5870 (2), new (2), insights (2), 649 (2), repository (2), signed (2), universe (2), training (2), integrations (2), stories (2), center (2), documentation (2), learn (2), business (2), fixes (2), products (2), secret (2), can, perform, action, share, personal, information, manage, cookies, contact, docs, privacy, terms, inc, app, branches, yet, relationships, assigned, assignees, already, account, join, conversation, free, libraries, dashboard, reporting, look, follow, special, handling, objects, suggested, looks, reasonable, regarding, though, suggest, converting, result, report, yup, arrays, avoided, costs, activity, reacted, marco, edward, gorelli, react, claude, helped, finding, analyzing, reproducing, writting, checked, reproduction, answer, questions, disclaimer, serializes, reduce, part, copied, encoded, serialize, msgspec, 5813, made, feat, make, express, dataframe, agnostic, via, 4790, necessary, 4836, to_pydatetime, 0rc0, related, workaround, until, pass, placed, directly, brings, example, above, 002, alternatively, convert, any, always, isinstance, false, should_load, get_module, handle, does, possible, plot, today, serialized, strings, ignores, shows, wall, clock, exactly, produces, only, losing, suffix, 01t00, should, expected, behavior, encodes, going, through, each, encode_as_datetime, encode_as_numpy, encode_as_pandas, plotlyjsonencoder, default, copies, to_dict, basefigure, __init__, deepcopy, handled, element, converts, values, datetime, gets, returns, unchanged, gives, pass_through, _plotly_utils, basevalidators, cause, notes, orjson, installed, 035, 039, 902, 363, 033, 894, 372, output, python, linux, default_engine, config, str, def, standard_normal, default_rng, random, europe, berlin, min, freq, periods, date_range, 100_000, graph_objects, run, script, steps, reproduce, applicable, performance, screenshots, video, reported, after, switch, based, measurements, reporter, had, mentioned, case, common, from, databases, apis, usually, comes, most, passes, to_datetime, plotting, timeseries, usual, way, very, 100, 000, points, plus, body, opened, items, issues, message, dismiss, alert, accounts, out, appearance, settings, search, pricing, event, talks, workshops, next, partners, company, forum, events, webinars, blog, resource, connect, resources, premium, advanced, ons, trust, why, evaluate, see, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, enterprises, stage, businesses, source, latest, improvements, across, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, environments, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, automated, work, hosting, review, collaboration, platform, menu, skip, content,
Text of the page (random words):
bug timezone aware pandas datetimeindex as x makes figure creation and to_json 30x slower issue 5864 plotly plotly py github skip to content navigation menu sign in products platform github repository hosting code review and collaboration copilot ai coding agent for tasks projects and automated work build ship actions ci cd and automation code quality quality analysis fixes and enforcement codespaces cloud development environments secure code security vulnerability detection and remediation secret protection secret scanning and leak prevention all features developers learn documentation training certifications build build with copilot customize copilot integrations explore trending repos github sponsors developer articles changelog changelog your source for the latest features improvements and fixes across github products all in one place businesses by stage enterprises team startups nonprofits by industry healthcare financial services manufacturing government see all industries evaluate github why github customer stories business insights trust center add ons github advanced security enterprise grade code security copilot for business enterprise grade ai features premium support enterprise grade 24 7 support resources learn connect documentation resource center blog events webinars community forum customer stories integrations support customer support training github status company about partners changelog github universe github universe the event for developers by developers talks workshops and what s next for github pricing search sign in sign up appearance settings you signed in with another tab or window reload to refresh your session you signed out in another tab or window reload to refresh your session you switched accounts on another tab or window reload to refresh your session dismiss alert message plotly plotly py repository navigation code issues 649 649 pull requests 87 87 actions security and quality insights more items bug timezone aware pandas datetimeindex as x makes figure creation and to_json 30x slower 5864 new issue copy link new issue copy link open 5870 open bug timezone aware pandas datetimeindex as x makes figure creation and to_json 30x slower 5864 5870 copy link labels p3 backlog backlog bug something broken something broken size 3 description stewit opened on nov 2 2026 issue body actions description plotting a timeseries the usual way go scatter x series index y series is very slow if the index is a timezone aware pd datetimeindex for 100 000 points go figure plus fig to_json takes about 2 3 s with the same timestamps as a timezone aware pd series or as a timezone naive datetimeindex it takes about 0 05 to 0 08 s timezone aware indexes are common data from databases apis or pd to_datetime utc true usually comes with datetime64 ns utc timestamps and series index is what most code passes as x 4250 reported that a pandas index slows down figure creation it was closed after the switch to narwhals in plotly 6 based on measurements with a timezone naive index the reporter had mentioned timezone aware indexes but that case was not measured again it is still slow in plotly 6 9 0 and 7 1 0 screenshots video not applicable this is about performance steps to reproduce run this script import time import numpy as np import pandas as pd import plotly import plotly graph_objects as go import plotly io as pio n 100_000 index pd date_range 2024 01 01 periods n freq min tz europe berlin y np random default_rng 0 standard_normal n def bench label x t0 time perf_counter fig go figure go scatter x x y y t1 time perf_counter fig to_json t2 time perf_counter print f label 24 x dtype str fig data 0 x dtype 15 figure t1 t0 6 3f s to_json t2 t1 6 3f s print plotly plotly __version__ pandas pd __version__ json engine pio json config default_engine bench tz naive datetimeindex index tz_localize none bench tz aware series index to_series bench tz aware datetimeindex index output python 3 14 linux plotly 6 9 0 pandas 3 1 0 json engine auto tz naive datetimeindex x dtype datetime64 us figure 0 035 s to_json 0 042 s tz aware series x dtype datetime64 us figure 0 008 s to_json 0 039 s tz aware datetimeindex x dtype object figure 0 902 s to_json 1 363 s plotly 7 1 0 pandas 3 1 0 json engine auto tz naive datetimeindex x dtype datetime64 us figure 0 033 s to_json 0 042 s tz aware series x dtype datetime64 us figure 0 008 s to_json 0 038 s tz aware datetimeindex x dtype object figure 0 894 s to_json 1 372 s it is the same with pandas 2 3 3 0 42 s 0 72 s for the timezone aware index and with orjson installed 0 91 s 1 01 s notes cause copy_to_readonly_numpy_array in _plotly_utils basevalidators py converts the values with narwhals for a timezone aware datetime series it calls replace_time_zone none so that local time is displayed and gets a datetime64 array a pd index is not a narwhals series so nw from_native pass_through true returns it unchanged and np array v then gives an object array of pd timestamp that object array is handled one element at a time copy deepcopy copies every timestamp in basefigure __init__ and again in to_dict which to_json calls plotlyjsonencoder default encodes every timestamp going through encode_as_pandas encode_as_numpy and encode_as_datetime for each one expected behavior a timezone aware datetimeindex should be as fast as a timezone aware series the plot would not change today the index is serialized as strings with utc offset like 2024 01 01t00 00 00 01 00 plotly js ignores the offset and shows the wall clock time which is exactly what the series path produces with replace_time_zone none only the json would change losing the offset suffix possible fix in copy_to_readonly_numpy_array handle a timezone aware pandas datetimeindex like the series path does pd get_module pandas should_load false if pd is not none and isinstance v pd datetimeindex and v tz is not none remove time zone so that local time is displayed like for series v v tz_localize none placed directly before nw from_native this brings the timezone aware index in the example above down to 0 002 s for figure and 0 038 s for to_json alternatively convert any pandas index to a series before nw from_native so that indexes always take the same path as series workaround until then pass x series index tz_localize none or x series index to_series related usage of a pandas index slows down figure generation of plotly 4250 usage of a pandas index slows down figure generation of plotly closed for plotly 6 0 0rc0 measured with a timezone naive index is v np array v dt to_pydatetime still necessary 4836 feat make plotly express dataframe agnostic via narwhals 4790 switched the series path to narwhals and datetime64 this made series and naive indexes fast but not timezone aware indexes serialize figures without deep copying them add a msgspec engine 5813 open serializes figures without deep copying them this would reduce the to_json part but the index would still be an object array of timestamps deep copied in figure and encoded one by one disclaimer claude code helped in finding analyzing reproducing and in writting this issue i personally checked the reproduction code and will answer personally to questions react with 1 reacted by marco edward gorelli activity stewit added bug something broken something broken on nov 2 2026 marcogorelli commented on nov 2 2026 marcogorelli on nov 2 2026 contributor more actions thanks for the report yup object arrays are to be avoided at all costs it s true that narwhals doesn t have special handling for index objects so your suggested fix looks reasonable regarding the comment though i would suggest something like remove time zone so that local time is displayed so that converting to numpy doesn t result in object dtype koolade85 commented on nov 2 2026 koolade85 on nov 2 2026 contributor more actions thanks for reporting this the team will take a look and follow up libraries dashboard added p3 backlog backlog size 3 on nov 2 2026 sign up for free to join this conversation on github already have an account sign in to comment metadata metadata assignees no one assigned labels p3 backlog backlog bug something broken something broken size 3 type no type projects no projects milestone no milestone relationships none yet development no branches or pull requests issue actions open in github copilot app footer 2026 github inc footer navigation terms privacy security status community docs contact manage cookies do not share my personal information you can t perform that action at this time
|
|
| Thumbnail images (randomly selected): * Images may be subject to copyright. | |  |
|
Verified site has: 59 subpage(s). Do you want to verify them? Verify pages:
|
The site also has references to the 4 subdomain(s)
|
The site also has 4 references to external domain(s).
|
|
|
Pages verified in the last hours (randomly selected):
|
|
Top 50 hastags from of all verified websites.
| |
|
|
|
|
|
|
Load Info| page size | 52194 | | load time (s) | 0.852968 | | redirect count | 1 | | speed download | 61260 | | server IP | 140.82.121.3 |
|
|
|
|
|
|
|
|
* Image may be subject to copyright.
|
|