Skip to content

Commit 03fc1b9

Browse files
Converted readme to markdown
1 parent c3a6ed6 commit 03fc1b9

File tree

5 files changed

+59
-66
lines changed

5 files changed

+59
-66
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 🎲 Transpose Dictionary
2+
3+
[![pip](https://badge.fury.io/py/transpose-dict.svg)](https://pypi.org/project/transpose-dict/)
4+
![python](https://img.shields.io/pypi/pyversions/transpose-dict)
5+
[![license](https://img.shields.io/pypi/l/transpose-dict)](https://github.com/LucaCappelletti94/deflate_dict/blob/master/LICENSE)
6+
[![downloads](https://pepy.tech/badge/transpose-dict)](https://www.pepy.tech/projects/transpose-dict)
7+
[![github](https://github.com/LucaCappelletti94/transpose_dict/actions/workflows/python.yml/badge.svg)](https://github.com/LucaCappelletti94/transpose_dict/actions/)
8+
9+
Python package to transpose Python dictionaries.
10+
11+
Multilevel dictionaries can be viewed as projections of sparse n-dimensional matrices: as such, you can transpose them on any of their axes.
12+
13+
The package provides a function that allows you to transpose a dictionary on any of its axes.
14+
15+
## Installing the transpose_dict package
16+
17+
As usual, just use pip as follows:
18+
19+
```shell
20+
pip install transpose_dict
21+
```
22+
23+
## Basic usage example
24+
25+
```python
26+
from transpose_dict import transpose_dict # or from transpose_dict import TD, for brevity
27+
28+
your_dictionary = {
29+
"a" : {
30+
"0" : {
31+
"I" : [1, 2, 3],
32+
"II" : [4, 5, 6]
33+
}
34+
},
35+
"b" : {
36+
"0" : {
37+
"I" : [8, 9, 10],
38+
"II" : [467, 23, 23]
39+
},
40+
"1" : {
41+
"III" : [6, 7, 9]
42+
}
43+
}
44+
}
45+
46+
transpose_dict(your_dictionary, axis=0) # The given dictionary does not change
47+
#> {"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]}}}
48+
transpose_dict(your_dictionary, axis=1) # The new main axis is the one with ("0", "1")
49+
#> {"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]}}}
50+
transpose_dict(your_dictionary, axis=2) # The new main axis is the one with ("I", "II", "III")
51+
#> {"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]}}}
52+
```
53+
54+
## License
55+
56+
The software is released under the MIT license.

README.rst

Lines changed: 0 additions & 64 deletions
This file was deleted.

dist/transpose_dict-1.2.0.tar.gz

4.46 KB
Binary file not shown.

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
here = path.abspath(path.dirname(__file__))
99

1010
# Get the long description from the relevant file
11-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
11+
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
1212
long_description = f.read()
1313

1414

@@ -44,6 +44,7 @@ def find_version(*file_paths):
4444

4545
description='Package to transpose dictionaries across any axes, just like n-dimensional matrices.',
4646
long_description=long_description,
47+
long_description_content_type='text/markdown',
4748

4849
# The project's main homepage.
4950
url='https://github.com/LucaCappelletti94/transpose_dict',

transpose_dict/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Current version of the transpose-dict package."""
2-
__version__ = "1.2.0"
2+
__version__ = "1.2.1"

0 commit comments

Comments
 (0)