Akantronics

Python for work that should not be done by hand

Python for work that should not be done by hand

Python for work that should not be done by hand

If you do the same job with copy-paste for the third time, it probably needs a script.

That is the simplest way I see Python. I do not see it only as a programming language. I see it as a tool. Something you open to save time, avoid mistakes, and make a boring task more stable.

Not every problem needs to become a big application. Sometimes it just needs a clean script that does exactly what it should.

Where I use it

Python is very strong for the small practical tasks that keep appearing:

  • reading a CSV,
  • cleaning data,
  • joining files,
  • creating a report,
  • filtering logs,
  • converting Excel files,
  • running calculations,
  • inserting data into SQLite,
  • building a small tool that is used every day.

These may not sound impressive. But in practice this is where a lot of time is lost.

Excel is not always enough

Excel is useful. I am not one of those people who say “do not use Excel”. In many cases it is the fastest tool.

But there is a point where it starts to hurt:

  • too many sheets,
  • manual copy-paste,
  • formula mistakes,
  • files with different versions,
  • the same process every day,
  • data that needs cleaning again and again.

That is where Python starts to make sense. It takes the process and makes it repeatable.

You do not need to remember which filter you used, which cell you changed, or which file was the correct one. The script does the same steps every time.

Python for data and reports

One of the most useful areas is reporting.

Very often the data exists. The problem is that it is not in a form that helps. It is inside files, logs, exports, or tables that need cleaning.

With Python you can:

  1. read the data,
  2. remove what is not needed,
  3. calculate values,
  4. find deviations,
  5. create tables,
  6. export clean results.

The result may not look “wow”. But if it saves half an hour every day, it matters.

Python and industry

In an industrial environment, Python does not replace the PLC. And it should not.

The PLC is for control. For real-time operation. For safety. For processes that must run reliably.

Python can work around it:

  • process production data,
  • organize measurements,
  • create reports,
  • clean exports,
  • help with troubleshooting,
  • connect tools together,
  • automate tasks that do not need to run in the PLC.

That combination is what I like. The PLC handles control. Python helps you use the data.

What I care about when writing Python

A script can become messy very easily. Especially if it starts as “just something quick” and then you keep adding things.

So I try to keep some basics:

  • clear names,
  • small functions,
  • error handling,
  • simple messages,
  • correct paths,
  • no “magic” values inside the code,
  • comments only where they help.

Not every script needs to become a huge project. But you should be able to open it two months later and understand what it does.

My conclusion

For me, Python is like a workshop tool. Just like you have a multimeter, a laptop, cables, and PLC software, you can also have Python.

Not to do everything. But for the work that should not be done by hand.

If something repeats, if it has too much copy-paste, if it often creates mistakes, if it wastes time for no reason, then it is worth looking at it as automation.

And for that, Python is one of the most practical tools available.

Python for work that should not be done by hand | Blog