Periodic Tableï
PeriodicTable.py module
An interactive wrapper around the mendeleev
library: element properties, isotope tables, mononuclidic elements, and a
bokeh-based periodic table you can hover over in a notebook.
Two classes are provided, sharing the same underlying data and methods:
TableauPeriodiqueâ the original, French-language class: element names, family names, and all printed output are in French.PeriodicTableâ an English-language subclass ofTableauPeriodique. It reuses everything (data, corrections, extra columns) but skips the French localization step, so element/family names and printed output are in English instead.
Note: both classes build on
mendeleevâs own element and isotope data (fetched once, at instantiation) and add a few corrections/extensions on top â a group-12 ânot a transition metalâ classification fix, a working first-ionization-energy column, and pedagogical warnings around mononuclidic/radiogenic elements and IUPAC/CIAAW atomic-weight ranges (see below).
Quick Startï
from pyphyschemtools import TableauPeriodique, PeriodicTable
# French
tp = TableauPeriodique()
tp.prop('O') # detailed properties of oxygen, in French
tp.isotopes('Cl') # isotope table + pedagogical warnings
tp.mononucleides() # all mononuclidic elements
tp.afficher() # interactive periodic table (bokeh)
# English
pt = PeriodicTable()
pt.prop('O')
pt.isotopes('Cl')
pt.mononucleides()
pt.afficher()
ou bien
import pyphyschemtools.PeriodicTable as PT
tp = PT.TableauPeriodique()
tp.prop(8)
Element propertiesï
prop(elt_id) prints a detailed summary of one element â symbol, atomic
number, electron configuration, group/period/block, family, molar mass,
natural isotopes, Pauling electronegativity, first ionization energy,
electron affinity, atomic radius, and a short textual description/sources/uses
(all from mendeleev). elt_id can be a symbol ('O') or an atomic number
(8).
Isotopesï
isotopes(elt_id) displays a table of an elementâs isotopes (mass number,
isotopic mass, natural abundance, half-life), sorted by increasing mass
number, followed by its molar mass. An isotope with no abundance listed is
simply not naturally occurring (e.g. the radioactive isotopes of a
radioelement).
Two pedagogical warnings are printed automatically when they apply:
Radiogenic reclassification. A handful of elements that look âmononuclidicâ at first glance (because
mendeleevlists more than one isotope with nonzero natural abundance) hold a non-primordial isotope produced by the decay of a longer-lived parent. Thorium is the IUPAC/CIAAW reference case: trace amounts of \(^{230}\text{Th}\), a decay product of \(^{238}\text{U}\), led the Commission to reclassify Th as binuclidic in 2013.IUPAC/CIAAW atomic-weight ranges. For 12 elements (H, Li, B, C, N, O, Mg, Si, S, Cl, Br, Tl), natural isotopic composition varies enough â by geological origin and, for some, industrial isotope separation â that IUPAC/CIAAW publishes a range
[min, max]rather than a single standard atomic weight.mendeleevâs singleatomic_weightvalue is only a conventional choice within that range, and is not guaranteed to equal \(\sum (\text{abundance} \times \text{isotopic mass})\) computed frommendeleevâs own isotope table (lithium is a striking example of this).
Mononuclidic elementsï
mononucleides(exclude_radiogenic=True) (French: exclure_radiogeniques)
lists every element with a single naturally-occurring isotope â symbol, mass
number, isotopic mass, molar mass, half-life (âstableâ when applicable). By
default, elements like thorium â which hold only a dominant primordial
isotope plus a radiogenic trace isotope â are excluded, matching the strict
IUPAC/CIAAW definition. Pass exclude_radiogenic=False to include them
instead; they are then marked with a trailing * and footnoted.
Implementation note: both classes fetch the whole isotopes and elements
tables in two bulk queries and group/merge them with pandas, rather than
querying mendeleev one element at a time â this brings the running time
down from several seconds to well under a tenth of a second.
Interactive periodic tableï
afficher(self) opens an interactive bokeh periodic table in the current
Jupyter notebook: each tile shows the symbol, atomic number, name and molar
mass, colored by family, with a hover tooltip giving name, family, atomic
number, molar mass, atomic radius, first ionization energy, electron
affinity, Pauling electronegativity and electron configuration â in French
for TableauPeriodique, in English for PeriodicTable.
API referenceï
- class pyphyschemtools.PeriodicTable.PeriodicTable[source]ï
Bases:
TableauPeriodiqueEnglish-language counterpart of
TableauPeriodique.Same underlying data (fetched through the âmendeleevâ library) and the same set of methods, but without the French localization patch: element and family/series names are left as mendeleev provides them (English), and all printed output (
prop,isotopes,mononucleides) is in English.Everything else â the group-12-is-not-a-transition-metal correction, the extra data merged in (first ionization energy), the radiogenic-isotope and CIAAW-interval warnings â is shared with
TableauPeriodiquevia inheritance.- afficher()[source]ï
Generates and displays the interactive periodic table in a Jupyter notebook.
Hover over a tile to see the elementâs properties.
- isotopes(elt_id)[source]ï
Prints an elementâs isotope table (mass number, natural abundance, half-life), sorted by increasing mass number.
Generalizes the thorium example: for a radioelement, the absence of an abundance value simply means that no isotope is stable/natural in mendeleevâs sense.
- Parameters:
elt_id (str or int) â Element symbol (e.g. âThâ) or atomic number (e.g. 90).
- mononucleides(exclude_radiogenic=True)[source]ï
Prints the mononuclidic elements, i.e. elements with a single isotope of measurable natural abundance (in mendeleevâs sense: abundance is not None).
- Parameters:
exclude_radiogenic (bool) â if True (default), excludes elements such as thorium, reclassified as binuclidic (or more) by the IUPAC in 2013 because of a trace radiogenic isotope (see TableauPeriodique.exceptionsRadiogeniques).
- class pyphyschemtools.PeriodicTable.TableauPeriodique[source]ï
Bases:
objectClasse permettant de manipuler et dâafficher les donnĂ©es du tableau pĂ©riodique.
Cette classe utilise la bibliothĂšque âmendeleevâ pour rĂ©cupĂ©rer les donnĂ©es chimiques et âbokehâ pour la visualisation interactive. Elle francise les noms et corrige certaines classifications de familles chimiques.
Initialise lâobjet TableauPeriodique en chargeant les donnĂ©es de la bibliothĂšque mendeleev.
Note
See also
PeriodicTable, the English-language counterpart of this class (same data and methods, but without the French localization patch).- afficher()[source]ï
GénÚre et affiche le tableau périodique interactif dans un notebook Jupyter.
Le tableau permet de visualiser les propriétés au survol de la souris.
- exceptionsRadiogenic = {90: '230-Th, a decay product of 238U (IUPAC/CIAAW, 2013)'}ï
- exceptionsRadiogeniques = {90: "230-Th, issu de la dĂ©sintĂ©gration de l'238U (IUPAC/CIAAW, 2013)"}ï
- intervallesCIAAW = {1: (1.00784, 1.00811), 3: (6.938, 6.997), 5: (10.806, 10.821), 6: (12.0096, 12.0116), 7: (14.00643, 14.00728), 8: (15.99903, 15.99977), 12: (24.304, 24.307), 14: (28.084, 28.086), 16: (32.059, 32.076), 17: (35.446, 35.457), 35: (79.901, 79.907), 81: (204.382, 204.385)}ï
- isotopes(elt_id)[source]ï
Affiche la table des isotopes dâun Ă©lĂ©ment (numĂ©ro de masse, abondance naturelle, demi-vie), triĂ©e par numĂ©ro de masse croissant.
GĂ©nĂ©ralise lâexemple du thorium : pour un radioĂ©lĂ©ment, lâabsence dâabondance signifie simplement quâaucun isotope nâest stable/naturel au sens de mendeleev.
- Parameters:
elt_id (str ou int) â Symbole de lâĂ©lĂ©ment (ex: âThâ) ou numĂ©ro atomique (ex: 90).
- mononucleides(exclure_radiogeniques=True)[source]ï
Affiche les Ă©lĂ©ments mononuclĂ©idiques, câest-Ă -dire possĂ©dant un seul isotope naturel (au sens de mendeleev : abundance non None).
- Parameters:
exclure_radiogeniques (bool) â si True (par dĂ©faut), exclut les Ă©lĂ©ments comme le thorium, reclassĂ©s binuclĂ©idiques (ou plus) par lâIUPAC en 2013 Ă cause dâisotopes radiogĂ©niques prĂ©sents en traces (voir TableauPeriodique.exceptionsRadiogeniques).
- nomsFr = ['HydrogĂšne', 'HĂ©lium', 'Lithium', 'BĂ©ryllium', 'Bore', 'Carbone', 'Azote', 'OxygĂšne', 'Fluor', 'NĂ©on', 'Sodium', 'MagnĂ©sium', 'Aluminium', 'Silicium', 'Phosphore', 'Soufre', 'Chlore', 'Argon', 'Potassium', 'Calcium', 'Scandium', 'Titane', 'Vanadium', 'Chrome', 'ManganĂšse', 'Fer', 'Cobalt', 'Nickel', 'Cuivre', 'Zinc', 'Gallium', 'Germanium', 'Arsenic', 'SĂ©lĂ©nium', 'Brome', 'Krypton', 'Rubidium', 'Strontium', 'Yttrium', 'Zirconium', 'Niobium', 'MolybdĂšne', 'TechnĂ©tium', 'RuthĂ©nium', 'Rhodium', 'Palladium', 'Argent', 'Cadmium', 'Indium', 'Ătain', 'Antimoine', 'Tellure', 'Iode', 'XĂ©non', 'CĂ©sium', 'Baryum', 'Lanthane', 'CĂ©rium', 'PrasĂ©odyme', 'NĂ©odyme', 'PromĂ©thium', 'Samarium', 'Europium', 'Gadolinium', 'Terbium', 'Dysprosium', 'Holmium', 'Erbium', 'Thulium', 'Ytterbium', 'Lutetium', 'Hafnium', 'Tantale', 'TungstĂšne', 'RhĂ©nium', 'Osmium', 'Iridium', 'Platine', 'Or', 'Mercure', 'Thallium', 'Plomb', 'Bismuth', 'Polonium', 'Astate', 'Radon', 'Francium', 'Radium', 'Actinium', 'Thorium', 'Protactinium', 'Uranium', 'Neptunium', 'Plutonium', 'Americium', 'Curium', 'Berkelium', 'Californium', 'Einsteinium', 'Fermium', 'Mendelevium', 'Nobelium', 'Lawrencium', 'Rutherfordium', 'Dubnium', 'Seaborgium', 'Bohrium', 'Hassium', 'Meitnerium', 'Darmstadtium', 'Roentgenium', 'Copernicium', 'Nihonium', 'Flerovium', 'Moscovium', 'Livermorium', 'Tennesse', 'Oganesson']ï
- patch_elements()[source]ï
Ce patch, appliquĂ© Ă self.elements, créé par lâappel Ă create_vis_dataframe(), va servir Ă : - corriger certaines classifications de familles (retire les Ă©lĂ©ments du groupe 12 de la
famille des métaux de transition, qui est le choix CONTESTABLE par défaut de mendeleev) ; cette partie est commune à TableauPeriodique et à sa sous-classe anglaise PeriodicTable
ajouter des informations localisées (noms des éléments et des familles) via self._localize_names(), surchargeable par une sous-classe
ajouter des données supplémentaires (énergie de premiÚre ionisation) via self._ajouter_donnees()
input : elements est un dataframe pandas préalablement créé par la fonction create_vis_dataframe() de mendeleev.vis
output : elements avec les colonnes ajoutées par _localize_names() et _ajouter_donnees() + correction des données name_series et series_id pour les éléments Zn, Cd, Hg, Cn
- prop(elt_id)[source]ï
Affiche les propriĂ©tĂ©s dĂ©taillĂ©es dâun Ă©lĂ©ment chimique.
- Parameters:
elt_id (str ou int) â Symbole de lâĂ©lĂ©ment (ex: âOâ) ou numĂ©ro atomique (ex: 8).
- trad = {'Actinides': 'Actinide', 'Alkali metals': 'MĂ©tal alcalin', 'Alkaline earth metals': 'MĂ©tal alcalino-terreux', 'Halogens': 'HalogĂšne', 'Lanthanides': 'Lanthanide', 'Metalloids': 'MĂ©talloĂŻde', 'Metals': 'MĂ©tal', 'Noble gases': 'Gaz noble', 'Nonmetals': 'Non mĂ©tal', 'Poor metals': 'MĂ©tal pauvre', 'Transition metals': 'MĂ©tal de transition'}ï