Skip to main content

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

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

periodic_table_dataclasses-1.0.tar.gz (27.8 kB view hashes)

Uploaded Source

Built Distribution

periodic_table_dataclasses-1.0-py3-none-any.whl (27.8 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