Data Science project 12
Predictive Maintenance Data Analysis Project
Build a complete predictive maintenance analysis workflow with reproducible Python code, traceable calculations, validation checks, and honest limitations.
Explore Data Science training in VizagView all project ideas
Analysis question
How does observed failure frequency vary across tool-wear bands and associated telemetry conditions?
Dataset
Three thousand synthetic telemetry records across 80 machine IDs with tool wear, temperature, torque, vibration, and a generated failure flag.
Requirements
- Python 3.10 or later
- A terminal or command prompt
python -m pip install numpy pandas- About 45-60 minutes to build and review
Method and data checks
Create quartile-based wear bands, calculate overall equipment KPIs, and compare failure rate, mean temperature, and vibration across bands.
- Wear bands contain comparable record counts
- Failure rate is a proportion rather than raw count
- Machine and record grain remain distinct
- No descriptive association is labelled a failure cause
Complete Python code
Save the program as ds_predictive_maintenance_analysis.py. The dataset generator or loader, analysis functions, output, and reproducibility controls are included.
"""Explore synthetic equipment telemetry and failure patterns."""
from __future__ import annotations
import numpy as np
import pandas as pd
def make_demo_telemetry(n: int = 3_000, seed: int = 42) -> pd.DataFrame:
rng = np.random.default_rng(seed)
tool_wear = rng.uniform(0, 250, n)
torque = np.clip(rng.normal(40, 10, n), 10, 80)
temperature = np.clip(rng.normal(65, 8, n) + 0.035 * tool_wear, 35, 105)
vibration = np.clip(rng.gamma(2.5, 0.8, n) + 0.009 * tool_wear, 0, 10)
logit = -8.2 + 0.018 * tool_wear + 0.055 * (temperature - 65) + 0.32 * vibration + 0.025 * np.maximum(torque - 50, 0)
probability = 1 / (1 + np.exp(-logit))
failed = rng.binomial(1, np.clip(probability, 0.002, 0.85))
return pd.DataFrame({"machine_id": rng.integers(1, 81, n), "tool_wear_hours": tool_wear, "temperature_c": temperature, "torque_nm": torque, "vibration_mm_s": vibration, "failed": failed})
def analyse_maintenance(data: pd.DataFrame) -> tuple[dict[str, float], pd.DataFrame]:
telemetry = data.copy()
telemetry["wear_band"] = pd.qcut(telemetry["tool_wear_hours"], q=4, labels=["low", "medium", "high", "very_high"])
by_wear = telemetry.groupby("wear_band", observed=True, as_index=False).agg(records=("failed", "size"), failure_rate=("failed", "mean"), mean_temperature=("temperature_c", "mean"), mean_vibration=("vibration_mm_s", "mean"))
return {"records": float(len(telemetry)), "machines": float(telemetry["machine_id"].nunique()), "failure_rate": float(telemetry["failed"].mean())}, by_wear
def main() -> None:
kpis, table = analyse_maintenance(make_demo_telemetry())
print({k: round(v, 4) for k, v in kpis.items()})
print(table.round(3).to_string(index=False))
print("Association is not causation; real maintenance rules require engineering validation.")
if __name__ == "__main__":
main()
Run the project
- Create and activate a virtual environment.
- Install dependencies with
python -m pip install numpy pandas. - Run
python ds_predictive_maintenance_analysis.py. - Reconcile row counts and totals before interpreting patterns.
- Read the limitations before substituting any real dataset.
Expected analytical output
Record count, machine count, overall failure rate, and a four-band telemetry summary.
Interpretation and responsible-use limits
Synthetic associations are not maintenance instructions. Real thresholds must account for sensor calibration, operating modes, censored failures, asset criticality, safety processes, and engineering approval.
Ways to extend the project
Add event timestamps, time-to-failure windows, machine-aware validation, survival analysis, cost tradeoffs, alert backtesting, and engineer-reviewed failure modes.
Continue learning Data Science
Try the next project, return to the Softenant project library, or explore the Data Science course in Vizag for guided data cleaning, analysis, visualisation, and portfolio feedback.