3 Python Projects That Will Help Automate Your Life
Most jobs have some tasks that add little value to our profession. Doing such tasks once isn’t a big deal, but when they become repetitive and time-consuming, they have to be automated.
By automating tasks you will stop wasting time doing mundane tasks and focus on what matters most for you. On top of that, you will put into practice all your knowledge in Python and even learn new things.
In this guide, I will show you 3 Python projects that helped me automate some of my everyday tasks at work and hopefully will help you too.
1. Automate Excel Reporting
Think of all the things you have to do to make an Excel reporting — you use Excel formulas, create a pivot table, make a chart, and format the worksheet.
Doing it once is easy, but things get complicated when you have to do it lots of times. Fortunately, Python can help you automate these tasks, so you’ll only need a couple of clicks the next time you have to make an Excel reporting.
How to solve this project
In Python, we can use openpyxl and Pandas to automate your Excel reporting. Here’s a guide I made to automate your Excel reporting with Python. Both are great Python libraries, but the downside is that it might take some time for beginners to learn openpyxl and it doesn’t have applications beyond Excel.
There’s an easier approach to automate your Excel reporting though. You only need to install a Python library named mitosheet (aka Mito). This library allows us to group data and calculate summary stats using an intuitive Excel-like interface. The best part is that Mito generates the code for each edit, so we’ll be able to see the Python code that corresponds to each edit.
In the example below, you can see how I used mitosheet’s interface to create a pivot table. After making the pivot table, the code is automatically created, isn’t that great?
To automate pivot tables and more Excel tasks you need to install the mitosheet library. To install it, first, open a new terminal or command prompt and then download the Mito installer with the following command:
python -m pip install mitoinstaller
Then, run the installer (this command may take a few moments to run)
python -m mitoinstaller install
That’s it! Check this link to learn how to create your first pivot table with mitosheet.
2. Automate Data Visualization
Most data analysis projects end with a presentation that contains lots of graphs. In my previous jobs, I’d update my Excel reporting and then manually make visualizations such as bar plots, piecharts, boxplots, and more.
This was time-consuming tough, so I looked for an alternative in Python. I found a couple of libraries that could help me automate plotting visualizations. I only had to read my updated Excel reporting with Python and by running a script all the visualizations would be created.
How to solve this project
To automate data visualization, first, we need to write code that creates the graph we want (preferably in a Jupiter Notebook file). Then write down how the input data (Excel file) should look like, so you make sure the column names, the shape of the data, data type, and other important features remain the same in the next update.
Now you might be wondering “how can I make visualizations with Python?” Well, Python offers different options to make standard as well as interactive visualizations. Here’s a guide to making visualizations with Matplotlib/Seaborn and here’s another guide to making interactive visualizations with Pandas/Plotly.
That said, learning such libraries might take you a good number of hours. Here Mito can help too. You can use Mito to make data visualization with a couple of clicks while generating the corresponding Python code. This code can be used to automate the creation of data visualization for future data.
Let’s have a look at how it works.