{"id":15706376,"url":"https://github.com/lucacappelletti94/transpose_dict","last_synced_at":"2025-05-08T20:48:09.129Z","repository":{"id":57476974,"uuid":"179446485","full_name":"LucaCappelletti94/transpose_dict","owner":"LucaCappelletti94","description":"Python package to transpose dictionaries, just like sparse n-dimensional matrices.","archived":false,"fork":false,"pushed_at":"2024-07-06T08:00:37.000Z","size":59,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T02:22:23.247Z","etag":null,"topics":["dictionary","python","transpose"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucaCappelletti94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"LucaCappelletti94"}},"created_at":"2019-04-04T07:38:04.000Z","updated_at":"2024-07-11T14:36:18.000Z","dependencies_parsed_at":"2024-10-24T07:42:27.319Z","dependency_job_id":"003aa353-4d12-4230-bc93-0b2d69a52d9c","html_url":"https://github.com/LucaCappelletti94/transpose_dict","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"19c3f1f87b1603716709b37430a4f1feb64b53bf"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaCappelletti94%2Ftranspose_dict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaCappelletti94%2Ftranspose_dict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaCappelletti94%2Ftranspose_dict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucaCappelletti94%2Ftranspose_dict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucaCappelletti94","download_url":"https://codeload.github.com/LucaCappelletti94/transpose_dict/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246515272,"owners_count":20790024,"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":["dictionary","python","transpose"],"created_at":"2024-10-03T20:22:30.755Z","updated_at":"2025-04-01T07:31:04.454Z","avatar_url":"https://github.com/LucaCappelletti94.png","language":"Python","readme":"# 🎲 Transpose Dictionary\n\n[![pip](https://badge.fury.io/py/transpose-dict.svg)](https://pypi.org/project/transpose-dict/)\n![python](https://img.shields.io/pypi/pyversions/transpose-dict)\n[![license](https://img.shields.io/pypi/l/transpose-dict)](https://github.com/LucaCappelletti94/deflate_dict/blob/master/LICENSE)\n[![downloads](https://pepy.tech/badge/transpose-dict)](https://www.pepy.tech/projects/transpose-dict)\n[![github](https://github.com/LucaCappelletti94/transpose_dict/actions/workflows/python.yml/badge.svg)](https://github.com/LucaCappelletti94/transpose_dict/actions/)\n\nPython package to transpose Python dictionaries.\n\nMultilevel dictionaries can be viewed as projections of sparse n-dimensional matrices: as such, you can transpose them on any of their axes.\n\nThe package provides a function that allows you to transpose a dictionary on any of its axes.\n\n## Installing the transpose_dict package\n\nAs usual, just use pip as follows:\n\n```shell\npip install transpose_dict\n```\n\n## Basic usage example\n\n```python\nfrom transpose_dict import transpose_dict # or from transpose_dict import TD, for brevity\n\nyour_dictionary = {\n    \"a\" : {\n        \"0\" : {\n            \"I\" : [1, 2, 3],\n            \"II\" : [4, 5, 6]\n        }\n    },\n    \"b\" : {\n        \"0\" : {\n            \"I\" : [8, 9, 10],\n            \"II\" : [467, 23, 23]\n        },\n        \"1\" : {\n            \"III\" : [6, 7, 9]\n        }\n    }\n}\n\ntranspose_dict(your_dictionary, axis=0) # The given dictionary does not change\n#\u003e {\"b\": {\"0\": {\"I\": [8, 9, 10], \"II\": [467, 23, 23]}, \"1\": {\"III\": [6, 7, 9]}}, \"a\": {\"0\": {\"I\": [1, 2, 3], \"II\": [4, 5, 6]}}}\ntranspose_dict(your_dictionary, axis=1) # The new main axis is the one with (\"0\", \"1\")\n#\u003e {\"0\": {\"a\": {\"I\": [1, 2, 3], \"II\": [4, 5, 6]}, \"b\": {\"I\": [8, 9, 10], \"II\": [467, 23, 23]}}, \"1\": {\"b\": {\"III\": [6, 7, 9]}}}\ntranspose_dict(your_dictionary, axis=2) # The new main axis is the one with (\"I\", \"II\", \"III\")\n#\u003e {\"I\": {\"a\": {\"0\": [1, 2, 3]}, \"b\": {\"0\": [8, 9, 10]}}, \"III\": {\"b\": {\"1\": [6, 7, 9]}}, \"II\": {\"a\": {\"0\": [4, 5, 6]}, \"b\": {\"0\": [467, 23, 23]}}}\n```\n\n## License\n\nThe software is released under the MIT license.","funding_links":["https://github.com/sponsors/LucaCappelletti94"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacappelletti94%2Ftranspose_dict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucacappelletti94%2Ftranspose_dict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucacappelletti94%2Ftranspose_dict/lists"}