René's URL Explorer Experiment


Title: Usage of a pandas.Index slows down figure generation of plotly · Issue #4250 · plotly/plotly.py · GitHub

Open Graph Title: Usage of a pandas.Index slows down figure generation of plotly · Issue #4250 · plotly/plotly.py

X Title: Usage of a pandas.Index slows down figure generation of plotly · Issue #4250 · plotly/plotly.py

Description: Hello everyone, I have noticed that the generation of a plotly figure takes ~20 longer if using the index of a pandas DataFrame. I have generated a minimal working example: import pandas as pd import numpy as np from plotly.subplots impo...

Open Graph Description: Hello everyone, I have noticed that the generation of a plotly figure takes ~20 longer if using the index of a pandas DataFrame. I have generated a minimal working example: import pandas as pd impo...

X Description: Hello everyone, I have noticed that the generation of a plotly figure takes ~20 longer if using the index of a pandas DataFrame. I have generated a minimal working example: import pandas as pd impo...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Usage of a pandas.Index slows down figure generation of plotly","articleBody":"Hello everyone,\r\n\r\nI have noticed that the generation of a plotly figure takes ~20 longer if using the index of a pandas DataFrame. I have generated a minimal working example:\r\n\r\n```\r\nimport pandas as pd\r\nimport numpy as np\r\nfrom plotly.subplots import make_subplots\r\nimport plotly.graph_objects as go\r\nfrom datetime import datetime\r\nimport time\r\n\r\nsize = 10000\r\ndf = pd.DataFrame({\"col1\": np.random.random(size),\r\n                   \"col2\": np.random.random(size),\r\n                   \"col3\": np.random.random(size),\r\n                   \"col4\": np.random.random(size)}, index=pd.date_range(datetime(2020, 1, 1), periods=size))\r\n\r\n# Preloads some plotly routines, which would otherwise be in the timing.\r\nfig = make_subplots()\r\n\r\ndef basic1(data):\r\n    start_time = time.perf_counter()\r\n    # fig = go.Figure()\r\n    fig = make_subplots()\r\n    for col in data:\r\n        fig.add_trace(go.Scattergl(x=data.index, y=data[col], name=\"ist_mpe\"))\r\n    # fig.show(\"browser\")\r\n    print(f\"Elapsed time: {time.perf_counter() - start_time}\")\r\n\r\n# Using the pandas DataFrame index\r\nbasic1(df)\r\n\r\n\r\ndef basic2(data):\r\n    start_time = time.perf_counter()\r\n    # fig = go.Figure()\r\n    fig = make_subplots()\r\n    for col in data:\r\n        fig.add_trace(go.Scattergl(x=data.index.values, y=data[col], name=\"ist_mpe\"))\r\n    # fig.show(\"browser\")\r\n    print(f\"Elapsed time: {time.perf_counter() - start_time}\")\r\n\r\n# Manually changing the index to a numpy array\r\nbasic2(df)\r\n```\r\n\r\nOn my machine I get the following output:\r\n\r\n```\r\nElapsed time: 0.11946500000000004\r\nElapsed time: 0.0073545000000000416\r\n```\r\n\r\nThe second approach, in which I manually transform the pandas Index to a numpy array, is > 10 times faster. Internally plotly saves data as DataFrames, it seems weird that the use of the index has such an impact.\r\n\r\nNote, when using a tz-aware DatetimeIndex, the above approach will firstly transform the dates to UTC+0. \r\n\r\nUsed Versions:\r\n\r\n\r\n```\r\nPackage         Version\r\n--------------- -------\r\nDateTime        5.1\r\nnumpy           1.24.3\r\npackaging       23.1\r\npandas          2.0.2\r\npip             23.0.1\r\nplotly          5.15.0\r\npython-dateutil 2.8.2\r\npytz            2023.3\r\nsetuptools      67.6.1\r\nsix             1.16.0\r\ntenacity        8.2.2\r\ntzdata          2023.3\r\nwheel           0.40.0\r\nzope.interface  6.0\r\n```\r\n","author":{"url":"https://github.com/SergejKr","@type":"Person","name":"SergejKr"},"datePublished":"2023-06-15T14:01:41Z","url":"https://github.com/plotly/plotly.py/issues/4250"}

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:475837af-2286-cabc-9740-5f2416060586
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD4D0:2EF149:4CA734:64705E:6B01775A
html-safe-nonce40c19c9636dbd60ff03bce31dc49d4c2496e5d0b2a600135290b241878605870
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEQwOjJFRjE0OTo0Q0E3MzQ6NjQ3MDVFOjZCMDE3NzVBIiwidmlzaXRvcl9pZCI6IjY1MDAzODA5MDIwNDI5OTA0MjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8e23ccf75b38287a16573ce64df850f54fa3bcbdccc0ec95a76ee0908772a8e2
hovercard-subject-tagissue:1758910812
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/4250/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ef75ea8ea73442e945adee53914809a2e1bc905794b2219820c98c489ab62350/plotly/plotly.py/issues/4250
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ef75ea8ea73442e945adee53914809a2e1bc905794b2219820c98c489ab62350/plotly/plotly.py/issues/4250
og:image:altHello everyone, I have noticed that the generation of a plotly figure takes ~20 longer if using the index of a pandas DataFrame. I have generated a minimal working example: import pandas as pd impo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSergejKr
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/4250#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fplotly%2Fplotly.py%2Fissues%2F4250
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%2F4250
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/4250
Reloadhttps://github.com/plotly/plotly.py/issues/4250
Reloadhttps://github.com/plotly/plotly.py/issues/4250
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/4250
New issuehttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/4250
Usage of a pandas.Index slows down figure generation of plotlyhttps://github.com/plotly/plotly.py/issues/4250#top
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
performancesomething is slowhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22performance%22
https://github.com/SergejKr
SergejKrhttps://github.com/SergejKr
on Jun 15, 2023https://github.com/plotly/plotly.py/issues/4250#issue-1758910812
gvwilsonhttps://github.com/gvwilson
on Jul 11, 2024https://github.com/plotly/plotly.py/issues/4250#event-13472886594
gvwilsonhttps://github.com/gvwilson
on Aug 2, 2024https://github.com/plotly/plotly.py/issues/4250#event-13740674234
gvwilsonhttps://github.com/gvwilson
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
performancesomething is slowhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22performance%22
on Aug 12, 2024https://github.com/plotly/plotly.py/issues/4250#event-13849322327
https://github.com/MarcoGorelli
MarcoGorellihttps://github.com/MarcoGorelli
on Dec 1, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2509771805
https://github.com/SergejKr
SergejKrhttps://github.com/SergejKr
on Dec 1, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2509802475
https://github.com/MarcoGorelli
MarcoGorellihttps://github.com/MarcoGorelli
on Dec 1, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2509804178
@SergejKrhttps://github.com/SergejKr
https://github.com/SergejKr
SergejKrhttps://github.com/SergejKr
on Dec 1, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2509811824
@MarcoGorellihttps://github.com/MarcoGorelli
https://github.com/MarcoGorelli
MarcoGorellihttps://github.com/MarcoGorelli
on Dec 1, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2509813196
@LiamConnorshttps://github.com/LiamConnors
https://github.com/LiamConnors
LiamConnorshttps://github.com/LiamConnors
on Dec 2, 2024https://github.com/plotly/plotly.py/issues/4250#issuecomment-2512218210
@MarcoGorellihttps://github.com/MarcoGorelli
@SergejKrhttps://github.com/SergejKr
LiamConnorshttps://github.com/LiamConnors
completedhttps://github.com/plotly/plotly.py/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 2, 2024https://github.com/plotly/plotly.py/issues/4250#event-15496810331
Sign up for freehttps://github.com/signup?return_to=https://github.com/plotly/plotly.py/issues/4250
Sign in to commenthttps://github.com/login?return_to=https://github.com/plotly/plotly.py/issues/4250
P3backloghttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22P3%22
performancesomething is slowhttps://github.com/plotly/plotly.py/issues?q=state%3Aopen%20label%3A%22performance%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.