Extensible Periodic Table of Elements

2.1.0 · active · verified Thu Apr 16

The `periodictable` library for Python (current version 2.1.0) provides an extensible periodic table of elements, pre-populated with data crucial for neutron and X-ray scattering experiments. It offers access to element properties such as mass, density, and scattering information. The library is actively maintained with regular updates to data sources and improvements. Its release cadence is driven by updates to fundamental physical constants and scattering data.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `periodictable` library, access individual elements by symbol or name, retrieve common properties like mass and density, iterate through the entire collection of elements, create and query chemical formulas, and access specific isotopes along with their properties like neutron scattering length.

import periodictable

# Access an element by its symbol
hydrogen = periodictable.H
print(f"Element: {hydrogen.name}, Symbol: {hydrogen.symbol}, Atomic Number: {hydrogen.number}, Mass: {hydrogen.mass:.3f} {hydrogen.mass_units}")

# Access an element by its full name
iron = periodictable.Fe
print(f"Element: {iron.name}, Density: {iron.density:.2f} {iron.density_units}")

# Iterate through all elements
from periodictable import elements
print("\nFirst 5 elements:")
for i, el in enumerate(elements):
    if i >= 5: break
    print(f"  {el.symbol}: {el.name}")

# Calculate properties for a chemical formula
water = periodictable.formula('H2O')
print(f"\nFormula: {water}, Molar Mass: {water.mass:.3f}")

# Access an isotope
nickel_58 = periodictable.Ni[58]
print(f"\nIsotope: {nickel_58.name}-{nickel_58.isotope}, Neutron Coherent Scattering Length: {nickel_58.neutron.coherent:.3f}")

view raw JSON →