Package capable of balance chemical equations and contains the most used portion of the periodic table of elements.
The package has two objects: chemeq and periodic_table.
1. chemeq
CLASS, Receives a string representing a chemical equation as input.
In the shape: "reactant_1 + ... + reactant_n = product_1 + ... + product_n".
The chemeq CLASS has three properties and one method.
is_balanced : Property. Boolean (True or False)
reactants : Property. pandas.DtataFrame where each row represents one of the reactants (left side)
compounds, molecular weights and elements.
products : Property. pandas.DtataFrame where each row represents one of the product (right side)
compounds, molecular weights and elements.
balance() : Method. Balances the equation if it is unbalanced.
2. periodic_table
pandas.DataFrame containing a portion of the periodic table of elements contains: Z, name, symbol, atomic mass,
atomic mass error, period, group & state.
Source for the periodic table of elements:
IUPAC - International Union of Pure and Applied Chemistry
https://iupac.org/what-we-do/periodic-table-of-elements/
LIMITATIONS
- Does not include Rare earths, synthetic elements, Radon, Francium & Radium.
- Intermediate prefixes like those from hydrates such as Cu(SO4)•5H2O
must be represented with subindexes like Cu(SO4)(H2O)5.
EXAMPLES
>>> from chemeq import chemeq
>>> eq = chemeq("C2H5(OH) + O2 = CO2 + H2O")
>>> eq.is_balanced
False
The balance status of the equation is also visible in the equation object itself.
>>> eq
<Unbalanced equation: "C2H5(OH) + O2 = CO2 + H2O">
To balance the equation invoke the balance() method
>>> eq.balance()
>>> eq.is_balanced
True
>>> eq
<Balanced equation: "C2H5(OH) + 3O2 = 2CO2 + 3H2O">
Example of its properties
>>> str(eq)
"C2H5(OH) + 3O2 = 2CO2 + 3H2O"
>>> eq.reactants
coefficient formula C H O Mass(g/mol)
0 1 C2H5(OH) 2 6 1 46.069
1 3 O2 0 0 2 31.998
>>> eq.products
coefficient formula C H O Mass(g/mol)
0 2 CO2 1 0 2 44.009
1 3 H2O 0 2 1 18.015</pre>
An equation can be created with their indexes to test if it is balanced. If it is not it can be balanced later.
>>> eq = chemeq("CuS + 8HNO3 = CuSO4 + 8NO2 + 4H2O")
>>> eq.is_balanced
True
>>> eq = chemeq("73CuS + 73HNO3 = 11CuSO4 + 11NO2 + 11H2O")
>>> eq.is_balanced
False
>>> eq.balance()
>>> eq
<Balanced equation: "CuS + 8HNO3 = CuSO4 + 8NO2 + 4H2O">
>>> from chemeq import periodic_table
>>> periodic_table
name symbol atomic_weight error group period state
atomic_number
1 Hydrogen H 1.0080 0.0002 1 1 g
2 Helium He 4.0026 0.0001 18 1 g
3 Lithium Li 6.9400 0.0600 1 2 s
4 Beryllium Be 9.0122 0.0001 2 2 s
5 Boron B 10.8100 0.0200 13 2 s
... ... ... ... ... ... ... ...
79 Gold Au 196.9700 0.0100 11 6 s
80 Mercury Hg 200.5900 0.0100 12 6 l
81 Thallium Tl 204.3800 0.0100 13 6 s
82 Lead Pb 207.2000 1.1000 14 6 s
83 Bismuth Bi 208.9800 0.0100 15 6 s
[67 rows x 7 columns]
Metadata
Release files for chemeq 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chemeq-0.1.7.tar.gz | 14.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chemeq-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.6 kB
Release files / chemeq-0.1.7.tar.gz
| Download URL | chemeq-0.1.7.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f26ddd238e90094d1c9279bdb920199c7e573cc19a4fa2414734459720dd5943
|
|
BLAKE2b-256 checksum How to use checksums |
e0aa60b514f8c6051bf41afb0640f3abd155f4e4facd40624104872295e1327b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / chemeq-0.1.7-py3-none-any.whl
| Download URL | chemeq-0.1.7-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82de1938d358bd5f27742425ab16154834236bff6488ae5dee091e8fde631550
|
|
BLAKE2b-256 checksum How to use checksums |
ead89b74c29a3a5774ae4b58e82d8d1a787a129d10c632b1349eb3da277e919d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|