Pychemist
The Alchemist of Data Science
Transform raw data into insights.
Pychemist is a lightweight Python library designed to simplify and enrich your data science workflow. Inspired by the transformation mindset of an alchemist, it helps you turn raw data into golden insights. Pychemist replaces complex, repetitive code with a clean and intuitive syntax that streamlines data cleaning, transformation, and preparation to reveal clear insights. It also enables clean and well-structured presentation of results, making it easier to communicate findings effectively.
Features
- Create lagged or lead variables for time-series and panel data
- Run quick, readable t-tests on treatment groups
- Filter model summaries to hide fixed effects
- Conditional mutation of DataFrames
- Pandas accessor (
.chem) for fluent, chainable workflows
Installation
pip install pychemist
Usage
import pychemist as chem
Example 1: Conditional mutation using the df.chem.mutate DataFrame accessor.
Update the total_assets for a specific company and year to a given value:
df=df.chem.mutate('company_id == "8ga62sav" & year==2025', "total_assets", 82000000)
Example 2: Conditional mutation using the df.chem.mutate DataFrame accessor.
Set the Promotion column to 1 for managers who haven't been promoted in 3 or more years and have a performance rating of at least 4; otherwise set it to 0.
df = df.chem.mutate('YearsSinceLastPromotion >= 3 & JobRole == "Manager" & PerformanceRating >= 4', 'Promotion', 1, 0)
Example 3: Creating lagged variables using the df.chem.lag DataFrame accessor.
Create lagged versions of total assets and net income for each ticker, only when the year difference is exactly 1:
df=df.chem.lag(['total assets','net income'],'ticker','year')
Example 4: Creating leading variables using the df.chem.lead DataFrame accessor.
Create lead (future) versions of total assets and net income for each ticker, only when the year difference is exactly 1:
df=df.chem.lead(['total assets','net income'],'ticker','year')
Example 5: Creating 2-year lagged variables using the df.chem.lag DataFrame accessor.
Create lagged versions of total assets and net income for each ticker, only when the year difference is exactly 2:
df=df.chem.lag(['total assets','net income'],'ticker','year',2)
Example 6: T-test between treated and control groups
chem.ttest(df, variable="outcome", treatment="treated")
Example 7: Model summary without fixed effects
import statsmodels.formula.api as smf
model = smf.ols("y ~ x + C(firm)", data=df).fit()
print(chem.summary_no_fe(model))
MIT License Copyright (c) Jeroen van Raak (2025)
Metadata
Release files for Pychemist 0.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pychemist-0.0.15.tar.gz | 12.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pychemist-0.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / pychemist-0.0.15.tar.gz
| Download URL | pychemist-0.0.15.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51d2b4d9455c1df553195e7def6959745e088355f6a431ab37c8069044d51b51
|
|
BLAKE2b-256 checksum How to use checksums |
ae18ea7081645b6ec4b66ecd78c4997980a0f39f2a9433d2ca1b845d338dafe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency logRelease files / pychemist-0.0.15-py3-none-any.whl
| Download URL | pychemist-0.0.15-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f73cba1f2602d0b253730b72eb06d1958eb82349792bdc1692bb520c11ad9ae
|
|
BLAKE2b-256 checksum How to use checksums |
d1a809a7526bf9a4fb5d6821a839a1d4703eb0992017cf3c8fd56db692abda05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.
Transparency log