René's URL Explorer Experiment


Title: Bar plot of pandas Series requires first index value to be 0 · Issue #16387 · matplotlib/matplotlib · GitHub

Open Graph Title: Bar plot of pandas Series requires first index value to be 0 · Issue #16387 · matplotlib/matplotlib

X Title: Bar plot of pandas Series requires first index value to be 0 · Issue #16387 · matplotlib/matplotlib

Description: Bug report Bug summary When trying to plot a pandas Series with pyplot.bar(), it seems Series whose first index is not 0 cause a TypeError: only size-1 arrays can be converted to Python scalars exception when the bottom argument is given...

Open Graph Description: Bug report Bug summary When trying to plot a pandas Series with pyplot.bar(), it seems Series whose first index is not 0 cause a TypeError: only size-1 arrays can be converted to Python scalars exc...

X Description: Bug report Bug summary When trying to plot a pandas Series with pyplot.bar(), it seems Series whose first index is not 0 cause a TypeError: only size-1 arrays can be converted to Python scalars exc...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/16387

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bar plot of pandas Series requires first index value to be 0","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nWhen trying to plot a pandas Series with pyplot.bar(), it seems Series whose first index is not 0 cause a `TypeError: only size-1 arrays can be converted to Python scalars` exception when the `bottom` argument is given. When `bottom` is not given, bar width is not uniform as expected.\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\nimport pandas as pd\r\nimport matplotlib.pyplot as plt\r\ndf = pd.DataFrame({'i':[1,4,4,4,6,6], 'n':[3,5,1,2,3,4]})\r\n\r\nix = df.index%2 == 0\r\nplt.figure()\r\n# produces expected plot with bars offset from x axis\r\nplt.bar(x=df.loc[ix,'i'], height=df.loc[ix, 'n'], bottom=df.loc[ix, 'i'])\r\nplt.figure()\r\n# produces expected plot\r\nplt.bar(x=df.loc[ix,'i'], height=df.loc[ix, 'n'])\r\n\r\nix = df.index%2 == 1\r\nplt.figure()\r\n# the following fails with `TypeError`\r\n# plt.bar(x=df.loc[ix,'i'], height=df.loc[ix, 'n'], bottom=df.loc[ix, 'i'])\r\n\r\n# converting to a list fixes the issue and produces the expected outcome.\r\n# note that casting both x and bottom to list is required to produce expected outcome.\r\nplt.bar(x=list(df.loc[ix,'i']), height=df.loc[ix, 'n'], bottom=list(df.loc[ix, 'i']))\r\n\r\nplt.figure()\r\n# produces plot with unexpected bar width\r\nplt.bar(x=df.loc[ix,'i'], height=df.loc[ix, 'n'])\r\n\r\n# again, converting to list produces expected outcome\r\nplt.figure()\r\nplt.bar(x=list(df.loc[ix,'i']), height=df.loc[ix, 'n'])\r\n```\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n  * Operating system: macOS 10.15\r\n  * Matplotlib version: 3.1.1\r\n  * Matplotlib backend (`print(matplotlib.get_backend())`): MacOSX\r\n  * Python version: 3.6.5\r\n  * Jupyter version (if applicable):\r\n  * Other libraries: pandas 0.25.2\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\nInstalled from conda, using default channel.\r\n","author":{"url":"https://github.com/zeeMonkeez","@type":"Person","name":"zeeMonkeez"},"datePublished":"2020-02-01T22:45:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/16387/matplotlib/issues/16387"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:09e9acaa-aa6a-0d43-ce93-951721c5bb05
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA6C0:DB1B4:291E28:3C1617:6A57440E
html-safe-nonced320ff5182a1bd589053de8a43a09021e8436b6cba85599954f3aac9626d212d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkMwOkRCMUI0OjI5MUUyODozQzE2MTc6NkE1NzQ0MEUiLCJ2aXNpdG9yX2lkIjoiMjc2MzMyMzE0MDQ1MzM4NTIzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac58c9bfc552036107b301a29a31c3d16e8a1f9f03c482e8dff3cb104417be9a30
hovercard-subject-tagissue:558609959
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/matplotlib/matplotlib/16387/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c912251068949dc43c365446a57b2c90a3168b90b11f4c3a7b571fff4ae7ff32/matplotlib/matplotlib/issues/16387
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c912251068949dc43c365446a57b2c90a3168b90b11f4c3a7b571fff4ae7ff32/matplotlib/matplotlib/issues/16387
og:image:altBug report Bug summary When trying to plot a pandas Series with pyplot.bar(), it seems Series whose first index is not 0 cause a TypeError: only size-1 arrays can be converted to Python scalars exc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezeeMonkeez
hostnamegithub.com
expected-hostnamegithub.com
None4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
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
release2576d1f0198cf1588faf2edf27f1ed120903be10
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/16387#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F16387
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F16387
Sign up https://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=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/16387
Reloadhttps://github.com/matplotlib/matplotlib/issues/16387
Reloadhttps://github.com/matplotlib/matplotlib/issues/16387
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/16387
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/16387
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 408 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Bar plot of pandas Series requires first index value to be 0https://github.com/matplotlib/matplotlib/issues/16387#top
third-party integrationhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22third-party%20integration%22
https://github.com/zeeMonkeez
zeeMonkeezhttps://github.com/zeeMonkeez
on Feb 1, 2020https://github.com/matplotlib/matplotlib/issues/16387#issue-558609959
third-party integrationhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22third-party%20integration%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.