Prints the schema of Python objects
Project description
print_schema
Ever had a complex Python object and wanted to easily see its structure? print_schema makes it super easy to display the structure of complex dictionaries, JSONs, lists, etc It differs from pprint in that this displays the structure rather than the object itself.
Installing
You can download this package from pip:
pip install print_schema
How to use this package
from print_schema import print_schema
my_dict = {"bts": {"members": 7,
"bias": "Kim Tae-hyung",
"albums": {"first": "Dark & Wild",
"peak_chart_position": {"Japan": 30, "Korea": 2},
"favorite_songs": ["Blood Sweat and Tears", "Boy with luv"]},
"more_members_alive_than_dead": True,
(2, 3): "a random tuple"},
"beatles": {"members": 4,
"bias": "George Harrisom",
"albums": {"first": "Please Please Me",
"peak_chart_position": {"UK": 1, "France": 5, "Germany": 5},
"favorite_songs": ["Eleanor Rigby", "While My Guitar Gently Weeps"]},
"more_members_alive_than_dead": False,
(4, 5): "another random tuple"}}
print_schema(my_dict, indent=3, dense=False)
Authors
- Surya Shekhar Chakraborty
License
This project is licensed under the MIT License - see the LICENSE file for details
Acknowledgments
This project started when I started looking for a native Python equivalent of PySpark/Scala's printSchema() and couldn't find any :)
Much thanks to my favorite after-hours colleague Puneet Jindal for all the help.
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
Built Distribution
Hashes for print_schema-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07334e96d017f11c0fdfdfc9848f805c0429a768e1ec7ad0e9b7f8903a565130 |
|
MD5 | f0a6eb1e4571173ccfb15df856af39af |
|
BLAKE2b-256 | b863f78ad75673c591896b9813a4e9ed274286d67dfe042f81a43a3102872a98 |