converts python dictoinary to class object
Project description
mclass: convert python dict to python class object
What is it?
mclass 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 mclass
Example
from mclass 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.4.tar.gz
(2.2 kB
view details)
Built Distribution
File details
Details for the file mclass-1.3.4.tar.gz
.
File metadata
- Download URL: mclass-1.3.4.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 | 414f786287b80a80261125fc9ed844dbf9093907e96999a2f0391a7b32a1cb60 |
|
MD5 | deb58131c14ccc6f33b409d641f50168 |
|
BLAKE2b-256 | 1ac1bcef375ab907942b67f81e80ed0df76e8cb19c155de3d52181ea17c3c707 |
File details
Details for the file mclass-1.3.4-py3-none-any.whl
.
File metadata
- Download URL: mclass-1.3.4-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 | 1382b4e93d2c1f6cbf88174643a7822e8877dab70f69cfd1044de7ea1f2fca52 |
|
MD5 | d12dc016151cd71627239a2cd31a9e24 |
|
BLAKE2b-256 | de55f0aa8725040bd019557bb6c6821310f4ae0183ff9c9db1981e98ef6b18e3 |