Skip to main content

converts python dictoinary to class object

Project description

mclass: convert python dict to python class object

PyPI Latest Release

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)

Uploaded Source

Built Distribution

mclass-1.3.4-py3-none-any.whl (2.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page