{"id":21343536,"url":"https://github.com/cloudmercato/django-pivot2","last_synced_at":"2026-05-05T13:41:20.745Z","repository":{"id":116894962,"uuid":"163010848","full_name":"cloudmercato/django-pivot2","owner":"cloudmercato","description":"Pivot table in Django","archived":false,"fork":false,"pushed_at":"2023-12-25T04:16:18.000Z","size":35,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-17T18:51:58.787Z","etag":null,"topics":["django","graphene","graphql","pandas","pivot-tables","python"],"latest_commit_sha":null,"homepage":null,"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/cloudmercato.png","metadata":{"files":{"readme":"README.rst","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-24T17:15:36.000Z","updated_at":"2024-05-02T04:11:07.000Z","dependencies_parsed_at":"2023-12-25T04:29:11.406Z","dependency_job_id":"371445b1-6d4c-4960-8272-47370a7cc837","html_url":"https://github.com/cloudmercato/django-pivot2","commit_stats":null,"previous_names":["cloudspectatordevelopment/django-pivot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudmercato/django-pivot2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmercato%2Fdjango-pivot2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmercato%2Fdjango-pivot2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmercato%2Fdjango-pivot2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmercato%2Fdjango-pivot2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudmercato","download_url":"https://codeload.github.com/cloudmercato/django-pivot2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudmercato%2Fdjango-pivot2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32652395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["django","graphene","graphql","pandas","pivot-tables","python"],"created_at":"2024-11-22T01:13:38.625Z","updated_at":"2026-05-05T13:41:20.708Z","avatar_url":"https://github.com/cloudmercato.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"============\ndjango-pivot\n============\n\ndjango-pivot is a wrapper around numpy, pandas and django-pandas letting\nyou easily manipulate pivot tables on your queryset.\n\nInstall\n=======\n\n::\n\n  pip install django-pivot2\n  \nModify your model(s) to use ``django_pandas.managers.DataFrameManager`` or\n``django_pandas.managers.DataFrameQuerySet``: ::\n\n  class LongTimeSeries(models.Model):\n    date_ix = models.DateTimeField()\n    series_name = models.CharField(max_length=100)\n    value = models.FloatField()\n\n    objects = DataFrameManager()\n    \nUsage\n=====\n\nThis app basicaly gives APIs to request a pivot table. Everything is not automatic\nand developer must always declare:\n\n- The possible values\n- The possible rows and columns\n\nAnd for a end-user the API will ask\n\n- Values\n- Rows\n- Columns\n- Aggregation functions\n- Applied function\n- Format\n\nAs class-based view\n-------------------\n\nA mixin is available to compose you own pivot. It has the following behavior:\n- Display a form to collect parameters of pivot table\n- Display pivot table as HTML if valid input is given\n- Download data as file with format given in form\n\nExample: ::\n\n  from django_filters.views import FilterView\n  from django_pivot.views import PivotView\n  from myapp import models\n\n  class LongTimeSeriesPivotView(PivotView, FilterView):\n      template_name = \"pivot.html\n      model = models.LongTimeSeries\n      \n      values_choices = ['date_ix', 'value']\n      rows_choices = cols_choices = ['serie_name', 'date_ix', 'value']\n      \n``PivotView`` is compatible with Django's ``ListView``, django-filters' ``FilterView``\nor any kind of view with the same behavior.\n\n\nWith graphene-django\n--------------------\n\nComing soon\n\nWith graphene-django-extras\n---------------------------\n\nExample of schema.py: ::\n\n  from graphene_django import DjangoObjectType\n  from django_pivot.contrib.graphene_django_extras import PivotField\n  from myapp import models\n\n  class LongTimeSeriesType(DjangoObjectType):\n      class Meta:\n          model = models.LongTimeSeries\n  \n  class Query:\n      pivot_long_time_series = PivotField(\n          LongTimeSeriesType,\n          filterset_class=filtersets.LongTimeSeriesFilter,\n          values_choices=['date_ix', 'value'],\n          rows_choices=['serie_name', 'date_ix', 'value'],\n          cols_choices=['serie_name', 'date_ix', 'value'],\n      )\n      \nExample of request: ::\n\n  query {\n    pivot_long_time_series (values: [\"value\"], rows: [\"serie_name\"], cols: [\"value\"], aggfuncs: [\"mean\"])\n  }\n\nAs GraphQL is supposed to return JSON only and pandas JSON format is ..hum... weird,\nwe convert pivot_table into CSV and after into a list of list, so fully compatible.\n\nWith Django REST Framework\n--------------------------\n\nComing soon\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudmercato%2Fdjango-pivot2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudmercato%2Fdjango-pivot2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudmercato%2Fdjango-pivot2/lists"}