Library for handling chemical formulas
Project description
Chela
Chela is a Python library to handle chemical formula.
Installation
Use the package manager pip to install Chela
pip install chela
Usage
From bash:
# Check correctness of chemical formula
python3 -m chela -c CHEMICAL_FORMULA
# Transform a csv file with a column containing the formulas
#into a dataframe with atomic symbols as columns and save it as a csv file
python3 -m chela -d FILE.csv NEW_FILE.csv
From python script:
import chela as cl
# check chemical formula with a function
cl.check_formula(CHEMICAL_FORMULA)
import pandas as pd
# check chemical formula with a pandas extensions
pd.DataFrame().chela.check_formula(CHEMICAL_FORMULA)
# Transform a pandas Dataframe with a column containing the formulas
#into a dataframe with atomic symbols as columns
dataset = pd.read_csv(FILE.csv)
dataframe = cl.build_dataframe(dataset)
dataframe = pd.DataFrame().chela.build_dataframe(dataset)
# Drop formulas contaning elements with atomic number greater than Z
dataframe = dataframe.chela.drop_heavy_elements(Z)
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chela-1.0.5.tar.gz
(5.7 kB
view hashes)
Built Distribution
chela-1.0.5-py3-none-any.whl
(7.5 kB
view hashes)