René's URL Explorer Experiment


Title: [BUG]: NaT inside a datetime64 array serializes as the string "NaT" instead of null · Issue #5829 · plotly/plotly.py · GitHub

Open Graph Title: [BUG]: NaT inside a datetime64 array serializes as the string "NaT" instead of null · Issue #5829 · plotly/plotly.py

X Title: [BUG]: NaT inside a datetime64 array serializes as the string "NaT" instead of null · Issue #5829 · plotly/plotly.py

Description: Description At 38374ac, a NaT inside a datetime64 array serializes as the string "NaT" on both engines. The same missing value as a list element or a scalar becomes null, and from_json reads the string back as data. $ python -I repro.py ...

Open Graph Description: Description At 38374ac, a NaT inside a datetime64 array serializes as the string "NaT" on both engines. The same missing value as a list element or a scalar becomes null, and from_json reads the st...

X Description: Description At 38374ac, a NaT inside a datetime64 array serializes as the string "NaT" on both engines. The same missing value as a list element or a scalar becomes null, and from_json re...

Opengraph URL: https://github.com/plotly/plotly.py/issues/5829

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: NaT inside a datetime64 array serializes as the string \"NaT\" instead of null","articleBody":"### Description\n\nAt `38374ac`, a `NaT` inside a datetime64 array serializes as the string `\"NaT\"` on both engines. The same missing value as a list element or a scalar becomes `null`, and `from_json` reads the string back as data.\n\n```\n$ python -I repro.py   # 38374ac, pandas 3.0.6, numpy 2.5.4, orjson 3.13.0\nstored : ndarray datetime64[us]\njson series -> ['2020-01-01T00:00:00.000000', 'NaT']\njson list   -> ['2020-01-01T00:00:00', None]\njson scalar -> null\njson round  -> ['2020-01-01T00:00:00.000000', 'NaT']\norjson series -> ['2020-01-01T00:00:00.000000', 'NaT']\norjson list   -> ['2020-01-01T00:00:00', None]\norjson scalar -> null\norjson round  -> ['2020-01-01T00:00:00.000000', 'NaT']\n```\n\nplotly.js happens to draw a gap for the string, so a chart looks right. Anything else that reads the figure JSON, such as Dash figure State, gets a string where `null` belongs.\n\n### Screenshots/Video\n\nNone: the defect is in the serialized JSON, quoted above.\n\n### Steps to reproduce\n\n```python\nimport json\nimport pandas as pd\nimport plotly.graph_objects as go\nimport plotly.io as pio\nfrom plotly.io._json import to_json_plotly\n\nseries = pd.Series(pd.to_datetime([\"2020-01-01\", None]))\nfig = go.Figure(go.Scatter(x=series))\nprint(\"stored :\", type(fig.data[0].x).__name__, fig.data[0].x.dtype)\nfig2 = go.Figure(go.Scatter(x=[pd.Timestamp(\"2020-01-01\"), pd.NaT]))\nfor e in (\"json\", \"orjson\"):\n    print(e, \"series ->\", json.loads(pio.to_json(fig, engine=e))[\"data\"][0][\"x\"])\n    print(e, \"list   ->\", json.loads(pio.to_json(fig2, engine=e))[\"data\"][0][\"x\"])\n    print(e, \"scalar ->\", to_json_plotly(pd.NaT, engine=e))\n    print(e, \"round  ->\", list(pio.from_json(pio.to_json(fig, engine=e), engine=e).data[0].x))\n```\n\n### Notes\n\n`contract: tests/test_optional/test_utils/test_utils.py:276` already asserts `null` for `pd.NaT` inside an object-dtype Series, and `:291` asserts `\"[null]\"` for `[pd.NaT]`. The datetime64 dtype of that same Series breaks the promise. The scalar case is `tests/test_io/test_to_from_plotly_json.py:265`.\n\nThe `json` engine (the `auto` fallback when orjson is absent) goes through `encode_as_numpy` at `_plotly_utils/utils.py:297`, and orjson goes through `clean_to_json_compatible` at `plotly/io/_json.py:517`. Both call `datetime_as_string` unfiltered:\n\n```diff\n-                return numpy.datetime_as_string(obj).tolist()\n+                return [\n+                    None if s == \"NaT\" else s\n+                    for s in numpy.datetime_as_string(obj).tolist()\n+                ]\n```\n\n```\n$ python -I repro.py | grep -E \"series|round\"   # filter at utils.py:297 only\njson series -> ['2020-01-01T00:00:00.000000', None]\njson round  -> ['2020-01-01T00:00:00.000000', None]\norjson series -> ['2020-01-01T00:00:00.000000', 'NaT']\norjson round  -> ['2020-01-01T00:00:00.000000', 'NaT']\n$ python -I repro.py | grep -E \"series|round\"   # same filter at _json.py:517 too\njson series -> ['2020-01-01T00:00:00.000000', None]\njson round  -> ['2020-01-01T00:00:00.000000', None]\norjson series -> ['2020-01-01T00:00:00.000000', None]\norjson round  -> ['2020-01-01T00:00:00.000000', None]\n# reverted: all four lines print 'NaT' again\n```\n\nNo CODEOWNERS entry covers these paths. @camdecoster, would you take a PR with the filter at both sites and a datetime64 case next to `test_pandas_json_encoding`?\n","author":{"url":"https://github.com/chrikrah","@type":"Person","name":"chrikrah"},"datePublished":"2026-10-20T03:46:50Z","url":"https://github.com/plotly/plotly.py/issues/5829"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:39b3aa79-12c8-ad00-ce6a-768a90c2e4ac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE26:213839:242772E:2E31C45:6B0177E4
html-safe-noncef2e884b0c923d5946bca832c5c832c367a5ae643f780958a9a8abd5faf09ddea
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTI2OjIxMzgzOToyNDI3NzJFOjJFMzFDNDU6NkIwMTc3RTQiLCJ2aXNpdG9yX2lkIjoiNjMyODgxODYyNTY1NTI1NDc2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9991c45e3759cde038acd6e3b355faa5d60aed7babac250212a3e29cd3607e5c
hovercard-subject-tagissue:5935562948
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.py/5829/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1f5f5c0bd25bbc117ab5b5da9e99e36ceb1f5435df1d90f6274098b7b5965289/plotly/plotly.py/issues/5829
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1f5f5c0bd25bbc117ab5b5da9e99e36ceb1f5435df1d90f6274098b7b5965289/plotly/plotly.py/issues/5829
og:image:altDescription At 38374ac, a NaT inside a datetime64 array serializes as the string "NaT" on both engines. The same missing value as a list element or a scalar becomes null, and from_json reads the st...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechrikrah
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/plotly/plotly.py git https://github.com/plotly/plotly.py.git
octolytics-dimension-user_id5997976
octolytics-dimension-user_loginplotly
octolytics-dimension-repository_id14579099
octolytics-dimension-repository_nwoplotly/plotly.py
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14579099
octolytics-dimension-repository_network_root_nwoplotly/plotly.py
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/plotly/plotly.py/issues/5829#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F5829
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F5829
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=plotly%2Fplotly.py
Reloadhttps://github.com/plotly/plotly.py/issues/5829
Reloadhttps://github.com/plotly/plotly.py/issues/5829
Reloadhttps://github.com/plotly/plotly.py/issues/5829
plotlyhttps://github.com/plotly
plotly.pyhttps://github.com/plotly/plotly.py
Codehttps://github.com/plotly/plotly.py
Issues650 (650)https://github.com/plotly/plotly.py/issues
Pull requests83 (83)https://github.com/plotly/plotly.py/pulls
Actionshttps://github.com/plotly/plotly.py/actions
Security and qualityhttps://github.com/plotly/plotly.py/security
Insightshttps://github.com/plotly/plotly.py/insights
https://github.com/plotly/plotly.py
New issuehttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/5829
New issuehttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/5829
[BUG]: NaT inside a datetime64 array serializes as the string "NaT" instead of nullhttps://github.com/plotly/plotly.py/issues/5829#top
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
bugsomething brokenhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22bug%22
size: 1https://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22size%3A%201%22
https://github.com/chrikrah
chrikrahhttps://github.com/chrikrah
on Oct 20, 2026https://github.com/plotly/plotly.py/issues/5829#issue-5935562948
@camdecosterhttps://github.com/camdecoster
https://github.com/camdecoster
camdecosterhttps://github.com/camdecoster
on Oct 20, 2026https://github.com/plotly/plotly.py/issues/5829#issuecomment-6299846030
camdecosterhttps://github.com/camdecoster
bugsomething brokenhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22bug%22
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
size: 1https://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22size%3A%201%22
on Oct 20, 2026https://github.com/plotly/plotly.py/issues/5829#event-33778850586
https://github.com/chrikrah
chrikrahhttps://github.com/chrikrah
on Oct 22, 2026https://github.com/plotly/plotly.py/issues/5829#issuecomment-6329862648
@camdecosterhttps://github.com/camdecoster
#5831https://github.com/plotly/plotly.py/pull/5831
@senanurcetinhttps://github.com/senanurcetin
#5831https://github.com/plotly/plotly.py/pull/5831
https://github.com/camdecoster
camdecosterhttps://github.com/camdecoster
on Oct 22, 2026https://github.com/plotly/plotly.py/issues/5829#issuecomment-6330984871
https://github.com/senanurcetin
senanurcetinhttps://github.com/senanurcetin
on Nov 4, 2026https://github.com/plotly/plotly.py/issues/5829#issuecomment-6634274684
@camdecosterhttps://github.com/camdecoster
#5831https://github.com/plotly/plotly.py/pull/5831
#5831https://github.com/plotly/plotly.py/pull/5831
#5831https://github.com/plotly/plotly.py/pull/5831
#5831https://github.com/plotly/plotly.py/pull/5831
https://github.com/hooriya067
hooriya067https://github.com/hooriya067
on Nov 20, 2026https://github.com/plotly/plotly.py/issues/5829#issuecomment-7038714527
#5831https://github.com/plotly/plotly.py/pull/5831
Sign up for freehttps://github.com/signup?return_to=https://github.com/plotly/plotly.py/issues/5829
Sign in to commenthttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/5829
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
bugsomething brokenhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22bug%22
size: 1https://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22size%3A%201%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.