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 hashes)
Built Distribution
mclass-1.3.4-py3-none-any.whl
(2.5 kB
view hashes)