Monday morning, production meeting. The maintenance lead says the line lost most of its time to "mechanical" stops last month. The shift supervisor says it was material shortages. Both are holding the same stop log, and both are right about what they remember. The log itself has 1,400 rows, and the same stop is written six different ways: "Motor", "motor fault", "MOTOR!!", "engine stopped", "mtr" and a blank. Nobody can say which few reasons really ate the hours.
I am Faramarz Ahmadi, and in my 24 years in manufacturing and data I have seen this meeting in almost every plant. The fix starts with a simple tool that quality engineers have used for decades: a Pareto of downtime. This is a free, practical tutorial for building one in Python, in your browser, with Google Colab, even if you have never written a line of code. The meeting above is a composite of situations I see often; the numbers are illustrative.

Why a downtime Pareto, and why in Python
A Pareto chart sorts stop reasons from the biggest to the smallest and adds a cumulative line. In most plants a handful of reasons explain most of the lost time, and the chart makes that visible in one glance. You can build it in Excel, but once the log gets long and messy, Python with the pandas library is faster to clean, easier to repeat every week, and it does not break when someone adds a column. Google Colab runs it in the browser, so there is nothing to install.
Step 1: Export the stop log as it is
Export last month's stops from your MES, your SCADA or the shift Excel file to a CSV file. You need at least four columns: line or machine, start time, duration in minutes and the stop reason as it was entered. Don't clean anything by hand first. The mess is part of what you want to measure.
Step 2: Load it in Google Colab
Open Google Colab, create a new notebook, upload the CSV from the file panel on the left and read it with pandas:
import pandas as pd
df = pd.read_csv("stops.csv")
df.head()
df["reason"].value_counts().head(30)
That last line is the moment of truth. It lists the 30 most frequent spellings of your stop reasons. In the illustrative log behind this article, the 1,400 rows had 212 different reason texts for what were really about 15 causes.
Step 3: Clean the reason text
Start with the easy part: lower-case everything, trim spaces and remove punctuation, so "MOTOR!!" and "motor" become the same word.
df["r"] = (df["reason"].fillna("unknown").str.lower()
.str.strip().str.replace(r"[^\w\s]", "", regex=True))
Then map the remaining variants to a short list of standard reasons with a small dictionary. Here is the idea with two lines; yours will be longer:
mapping = {"motor fault": "Motor", "mtr": "Motor"}
df["code"] = df["r"].map(mapping).fillna("Unmapped")
ChatGPT or Claude can help you draft that dictionary: paste the list of unique texts and ask it to group them. Then check every group yourself. I have seen an AI tool merge "no material" and "no operator" into one reason because both started with "no", and that one mistake would have sent the whole improvement effort to the wrong department.
Step 4: Sum the minutes, not the count
This is where most first attempts go wrong. Counting stops tells you what happens often. Summing minutes tells you what costs you time. A jam that happens 200 times for one minute and a die change that happens 8 times for 90 minutes give two very different charts.
p = df.groupby("code")["minutes"].sum().sort_values(ascending=False).to_frame()
p["cum_pct"] = p["minutes"].cumsum() / p["minutes"].sum() * 100
p
Step 5: Draw the Pareto chart
Bars for minutes, a line for the cumulative percentage. A few lines of matplotlib do it, and Colab shows the chart right under the code:
import matplotlib.pyplot as plt
ax = p["minutes"].plot(kind="bar", figsize=(10, 5))
p["cum_pct"].plot(ax=ax, secondary_y=True, color="red", marker="o")
plt.show()
In the illustrative sample, four reasons out of fifteen explained about 68% of the lost minutes, and "material shortage", which nobody on the maintenance side had mentioned, was second. That changed the conversation in the meeting from "whose fault" to "which two things first".
Step 6: Run it again every week
Save the notebook. Next week, upload the new CSV with the same name and choose Runtime > Run all. Watch the "Unmapped" row: if it grows, people are inventing new reason texts and the dictionary needs a few more lines. If you want the same result inside Excel or Power BI later, the logic is identical; I showed the Excel side of factory data in how to calculate OEE in Excel with AI.
What this first Pareto will not tell you
A Pareto shows where the minutes went. It does not tell you why. "Motor" is a symptom, not a cause, and the biggest bar is not always the best place to start. Some long stops are planned and should never be in the chart at all, and some short stops hide inside "running slowly" and never reach the log. I wrote about why the first answer from downtime data is often wrong in downtime data and ChatGPT. If your stop reasons are written as long free text, text mining maintenance logs with Python is the next step up.
FAQ
What is a downtime Pareto chart?
It is a bar chart of stop reasons sorted from the largest to the smallest lost time, with a cumulative percentage line. It shows the few reasons that cause most of the downtime, so you know where to look first.
Do I need to install Python to build it?
No. Google Colab runs Python in your browser for free. You only need a Google account and your stop log as a CSV file.
Should a downtime Pareto use the number of stops or the minutes lost?
Start with minutes lost, because that is what costs output. The count of stops is useful as a second view, especially for short, frequent stops that frustrate operators.
How do I clean inconsistent stop reasons?
Lower-case and trim the text, remove punctuation, then map the remaining variants to a short list of standard reasons. AI tools can draft the mapping, but a person who knows the line should check every group.
Can I do the same in Excel or Power BI?
Yes. The steps are the same: clean the reason, group, sum the minutes, sort and add a cumulative percentage. Python simply makes it faster to repeat on long, messy logs.
What I keep for the actual work
When I do this with a plant, the chart is the easy part. The value is in what sits around it: the standard stop-reason list I agree with production and maintenance so the log stays clean after the first week, the rules for which stops belong in the chart and which don't, how short stops and slow running are brought into the picture, and how the Pareto is tied to OEE and to money so the right bar gets fixed first. That depends on your machines and your people, so I do it with your team, on your data.
Curious which few stops are really eating your hours?
Send me a few lines about your line, how stops are recorded today and roughly how many rows a month you have. I will tell you honestly what a first Pareto could show and where I would look first. Very often the answer is sitting in a log you already collect.
Contact me Read: Power Query tutorial Read: OEE up, profit flat
More practical tutorials: plan vs actual in Power BI, step by step and a weekly production plan in Excel with ChatGPT.