Skip to content

Repository files navigation

Python for Applied Chemistry

Launch in Binder Python 3.9+

A short, hands-on course that teaches Python by using it to do real chemistry: analysing lab data, plotting results, and exploring reactions. Every lesson is a Jupyter notebook you can run in your browser without installing anything.

New here? Go straight to Run it in your browser. You will be running real chemistry code in a minute or two.

Table of Contents

Run it in your browser

The easiest way to start is Binder. Click the button below. Binder reads this course's requirements.txt, installs everything for you, and opens Jupyter in your browser. Nothing to download.

Launch in Binder

The first launch takes a minute or two while Binder sets up the environment. After that, open a lesson from the file list on the left and run each cell with Shift and Enter.

Prefer to open one specific lesson directly? Use the per-lesson buttons in The lessons below. Each lesson has a Binder button (everything preinstalled) and a Colab button (fast to open, see the Colab note).

What you will learn

  • Reading and cleaning real lab data with pandas
  • Doing calculations with numpy
  • Turning numbers into clear plots with matplotlib
  • Working with reactions and chemical quantities using chempy
  • Building the habit of exploring data in a notebook, one cell at a time

No prior Python is assumed. Basic chemistry (concentrations, reactions, titrations) is helpful but each idea is explained as it comes up.

The lessons

Work through them in order. Each button opens that lesson ready to run.

Lesson Topic Open (everything ready) Open (fast)
1. Python Basics for Chemistry Variables, lists, and simple calculations, using chemistry examples Binder Colab
2. Data Analysis and Plotting Loading CSV lab data with pandas and plotting it with matplotlib Binder Colab
3. Cheminformatics with ChemPy Balancing reactions and working with chemical quantities Binder Colab

There are also slides, Python_for_Applied_Chemistry.pptx, that introduce the course.

Datasets

The lessons use small, real CSV datasets kept in the datasets/ folder:

  • nwsc_water_quality.csv - water quality measurements
  • reaction_kinetics.csv - reaction rate data over time
  • titration_data.csv - titration readings

When you launch with Binder or Codespaces these come along automatically. In Colab they load straight from this repository.

Run it on your own machine

If you would rather not use the browser:

  1. Clone the repository:
    git clone https://github.com/Kubomu/chemistry-python-course.git
    cd chemistry-python-course
  2. Install the packages:
    pip install -r requirements.txt
  3. Start Jupyter and open a lesson:
    jupyter lab

You can also open the folder in GitHub Codespaces (Code button, then Codespaces) and the environment installs itself.

A note for Google Colab users

Colab opens instantly and already has pandas, numpy, and matplotlib, so Lessons 1 and 2 run as is. Lesson 3 uses chempy, which Colab does not include by default. When you open Lesson 3 in Colab, add a new cell at the very top and run this once:

!pip install chempy

Then run the rest of the notebook normally. Binder does not need this step because it installs everything from requirements.txt for you.

About

Happy Coding ๐Ÿ˜Š

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages