A small, self-contained data-analysis project that takes a CSV of infant feeding records and produces interpretable visualizations of feeding patterns over time of day and across months. Started as a personal project to make sense of my own baby's feeding log; rebuilt here as a portfolio piece for messy real-world time-series data wrangling in pandas.
Author: Osmanjan Timtura, Ph.D. · LinkedIn · GitHub
The repo ships with two synthetic feeding datasets so the pipeline runs out of the box. Running the analysis on data/sample_breast_milk.csv (5 months of records, July–November 2022) produces:
The plot is dense with biological signal:
- A late-night feed at ~2am is visible in every month — most newborns wake to eat once overnight.
- A 5am dip (no feedings) — the typical longest sleep stretch.
- Daytime feedings are roughly hourly with amounts averaging 0.5–1.5 oz per hour.
- Each month's curve sits slightly higher than the previous month — visible growth: the same baby is taking in more milk per feeding as it ages.
And the daily-total view:
The 7-day rolling mean (red) shows daily intake growing from ~13 oz/day at 1 month old to ~28 oz/day at 5 months old — a clean monotonic trend buried in day-to-day noise. This is exactly the kind of signal that simple aggregation reveals and that staring at the raw CSV does not.
For a comp-bio / data-science portfolio, this is the "I can wrangle messy real-world time-series data with pandas" piece. Specifically:
- Timestamp parsing from human-written CSV (
"7/14/22 7:30 AM"format) into proper pandasdatetime64. - Two-level groupby aggregation (
month×hour-of-day) to compute per-bin averages with denominators that match the actual data structure (per-day, not per-record). - Two views of the same data: hour-of-day pattern within each month, and daily-total trend across the whole record.
- A rolling mean layered onto a daily series to separate signal from day-to-day noise.
- Synthetic-data generator that mimics realistic priors (longer night intervals, growth-per-month, occasional missed-log days) so the repo is reproducible without sharing real personal data.
- Tests that verify the aggregation math on a hand-checkable small input.
- CLI + library + notebook entry points so the code is usable three ways.
git clone https://github.com/OsmanjanTimtura/baby-feeding-trend.git
cd baby-feeding-trend
pip install -r requirements.txt
# Regenerate the synthetic sample CSVs (already committed, but rerun if needed)
python -m src.generate_sample
# Run the analysis with daily-total plot included
python -m src.feeding data/sample_breast_milk.csv --out figures/trend.png --daily
# Plot only specific months
python -m src.feeding data/sample_breast_milk.csv --months 2022-07 2022-11 --out figures/jul_nov.pngTotal runtime: under 2 seconds on a laptop. No GPU, no model download.
The pipeline accepts any CSV with two columns:
| Column | Format | Example |
|---|---|---|
Time |
Date + 12-hour time + AM/PM | 7/14/22 7:30 AM |
Amount (oz.) |
Numeric ounces per feeding | 2.5 |
(Older Time and Amount (oz.) column names are kept for backward compatibility with feeding-tracker app exports. The pipeline renames them internally to timestamp and amount_oz.)
from src.feeding import load_feeding_csv, plot_monthly_trends
df = load_feeding_csv("data/my_baby.csv")
plot_monthly_trends(df, output="figures/my_trend.png")baby-feeding-trend/
├── README.md (this file)
├── requirements.txt
├── LICENSE (MIT)
├── .gitignore
├── src/
│ ├── __init__.py
│ ├── feeding.py (main analysis pipeline)
│ └── generate_sample.py (creates synthetic test data)
├── data/
│ ├── sample_breast_milk.csv (5 months synthetic data, 1051 records)
│ └── sample_formula.csv (4 months synthetic data, 727 records)
├── figures/
│ ├── feeding_trend_breast_milk.png (headline figure)
│ └── daily_total.png (growth-over-time plot)
├── notebooks/
│ └── feeding_demo.ipynb (interactive walkthrough)
└── tests/
└── test_feeding.py (pytest unit tests)
Python 3.10+ · pandas · numpy · matplotlib · pytest
The original version of this project ran on records of my own child. For the portfolio version, that data is replaced with a synthetic generator (src/generate_sample.py) that produces realistic-looking records using documented priors (feeding intervals, amount growth per month, miss-day probability). The synthetic data lets anyone reproduce the analysis end-to-end without me sharing private records.
The first version of this script was a personal exploratory project written in Python in 2023 to analyze a CSV exported from a baby-tracking app. The current portfolio version is a refactor: pandas-idiomatic aggregation replaces the original manual hour-of-day if/elif chains, a CLI replaces hardcoded file paths, and synthetic data replaces the real records. The original analysis question — "how do this baby's feeding patterns change over months?" — remains the same.
MIT License — reuse freely.

