converts python dictoinary to class object
Project description
diclass: convert python dict to python class object
What is it?
diclass It fully converts a python dict to a python class object and all dict keys and internal dict are converted to python class objects as well.
# !pip install diclass
Example
from diclass import DictClass
import pandas as pd
import numpy as np
obj = DictClass({'id':1, 'data':{'name':'John', 'age':31, 'wife':{'name':'Jessica', 'age':np.nan}}})
print(obj.id, obj.data.name, obj.data.wife.name)
1 John Jessica
obj
{'id': 1, 'data': {'name': 'John', 'age': 31, 'wife': {'name': 'Jessica', 'age': nan}}}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mclass-1.3.3.tar.gz
(2.2 kB
view details)
Built Distribution
File details
Details for the file mclass-1.3.3.tar.gz
.
File metadata
- Download URL: mclass-1.3.3.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84338d9fcbba32e93cc9ba88922eeefeb57c22575df19d27f75c0d1c17a4ae14 |
|
MD5 | 941da2c3382ffc9cc4092e842428b072 |
|
BLAKE2b-256 | 87f7e6c2263fca3b1b4c203c919c15e6d4d74aa1bbdec7dee496d3cd61b90bd8 |
File details
Details for the file mclass-1.3.3-py3-none-any.whl
.
File metadata
- Download URL: mclass-1.3.3-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be263f4c57e39abbcb0f41617450ad4c65ce1f1dfa8d50a3b7da425c03c8a32c |
|
MD5 | 17bd91f0dc01122587dffef374195a91 |
|
BLAKE2b-256 | ae9360eb728fedca54e0747f9e4cd39df3aa7ce7b1b52d6086641930219c24bb |