{"id":13937586,"url":"https://github.com/tomasd/pandas-sqlalchemy-pivot","last_synced_at":"2025-07-19T23:33:15.062Z","repository":{"id":4761349,"uuid":"5911755","full_name":"tomasd/pandas-sqlalchemy-pivot","owner":"tomasd","description":"Pivot tables for sqlalchemy","archived":true,"fork":false,"pushed_at":"2012-10-06T17:15:09.000Z","size":120,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-08T23:27:43.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomasd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-22T09:14:49.000Z","updated_at":"2023-01-28T19:45:55.000Z","dependencies_parsed_at":"2022-08-28T07:20:12.175Z","dependency_job_id":null,"html_url":"https://github.com/tomasd/pandas-sqlalchemy-pivot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasd%2Fpandas-sqlalchemy-pivot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasd%2Fpandas-sqlalchemy-pivot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasd%2Fpandas-sqlalchemy-pivot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasd%2Fpandas-sqlalchemy-pivot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasd","download_url":"https://codeload.github.com/tomasd/pandas-sqlalchemy-pivot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226700611,"owners_count":17668678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-07T23:03:42.469Z","updated_at":"2024-11-27T06:30:33.677Z","avatar_url":"https://github.com/tomasd.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"pandas-sqlalchemy-pivot\n================\n\nProvides pivot functionality for databases. Pivot aggregates are created\ndirectly in the database. Reshaping into pivot is done in the pandas framework.\n\nUsage\n=====\n    table.insert().execute(customer_id=1, yearmonth='201001', gender='male', price=10)\n    table.insert().execute(customer_id=2, yearmonth='201001', gender='male', price=5)\n    table.insert().execute(customer_id=3, yearmonth='201001', gender='female', price=10)\n\n    select = sqlalchemy.select(table.c.yearmonth, table.c.gender, table.c.price)\n\n    table = pivots.pivot_table_from_select(\n                select,\n                rows='yearmonth', cols='gender', values='price'\n            )\n\n    print table\n\nOutputs:\n\n                price\n    gender     female  male\n    yearmonth\n    201001         10    15\n\n\nFor more examples look at tests.\n\nSimilar projects\n================\nSimilar project for postgresql is Mali Akmanalp's https://github.com/makmanalp/sqlalchemy-crosstab-postgresql","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasd%2Fpandas-sqlalchemy-pivot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasd%2Fpandas-sqlalchemy-pivot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasd%2Fpandas-sqlalchemy-pivot/lists"}