Python library of Periodic-Table-JSON
Project description
A Python library of periodic data statically generated from PeriodicTableJSON.json (https://github.com/NMRbox/Periodic-Table-JSON) on 2023 Jan 28.
An Element dataclass and PeriodicTable container class is generated from the JSON data.
Currently only the single valued str, float, and int are supported. The JSON fields shells, ionization_energies, image are omitted.
Installation
pip install periodic_table_dataclasses
Usage
from periodic_table import PeriodicTable
pt = PeriodicTable()
h = pt.search_name('hydrogen')
s = pt.search_number(16)
fe = pt.search_symbol('Fe')
for element in pt.elements:
print(element)
Discussion
Unnecessary
This module is not necessary to use PeriodicTableJSON.json in Python.
with open('PeriodicTableJSON.json') as f:
data = json.load(f)
elements = data['elements']
will bring all data into Pyton as nested data structure.
Convenient
The module was implemented for the convenience of named class fields. A static definition allows type checking and code completion when working in Python integrated development environments (IDE).
Additional feature
The PeriodicTable.search_name features supports the British spellings aluminium and sulphur.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file periodic_table_dataclasses-1.0.tar.gz
.
File metadata
- Download URL: periodic_table_dataclasses-1.0.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/65.6.3 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cd0b5055b747fbb2b3333fee90df191d3025cf030a41d8beda996e68a1fc97b |
|
MD5 | f49456d819f970b98dcca73afd23d918 |
|
BLAKE2b-256 | a982584f3d221aab9867697f72ec8b00ed1250b68620d046265b7d4dae030693 |
File details
Details for the file periodic_table_dataclasses-1.0-py3-none-any.whl
.
File metadata
- Download URL: periodic_table_dataclasses-1.0-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/65.6.3 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 367b7f57a6db8eb20e49c0d75f00f820f78a6b6b08edb023f6c29812b4b99a85 |
|
MD5 | f198e13c5251ce03b2c643fd00ced946 |
|
BLAKE2b-256 | e02e916dbb995df98cf0dfc7ed6ce79886e6fa973881fb307f382bb6b6061c13 |