Schedule Your Python Scripts On Windows Platform

Schedule Your Python Scripts On Windows Platform

Schedule Your Python Scripts On Windows Platform. In this tutorial, we will learn to schedule Python scripts on a Windows platform.

Let’s think of a scenario before we start with this tutorial:

Your manager calls you and instructs, “_the client wants refreshed data every day by 6 AM IST. Please change your shift timings and ensure script execution post client’s batch completes”. _What does this mean? This means, starting today, you will start losing your precious sleep, time with family and friends, and above all, will be working on executing some random script at the most unproductive hour of the day.

If the above sounds familiar and you want to save yourself from a nightmare like this, please read further. In this tutorial, we will learn to schedule Python scripts on a Windows platform.

First Things First

The achieve our objective, we need 3 things:

  • Python Script —For this tutorial, I have written a small Python code that reads a “CSV” file *from my Windows folder location. This “CSV” file *contains 2 columns, each having random numbers. The code *adds both the columns to create a new one *and *saves this new version *of the CSV file at the same folder location.
##### Importing the required library
import pandas as pd

##### Reading csv file
df = pd.read_csv("C:\\Ujjwal\\New_File_V1.csv")
##### Adding 2 columns
df["Third_Column"] = df["Randome Numbers 1"] + df["Random Numbers 2"]
##### Exporting the data to same location
df.to_csv("C:\\Ujjwal\\New_File_V2.csv",index = False)
  • Batch File *— A batch file is a *script file with a “.BAT” extension. These files are generally saved as simple text files and contain commands which can be executed on the command-line interface *(command prompt). When the command prompt executes these files, it reads through the commands written in the file and *executes them line by line.
  • *Scheduler *— Last but not the least, *we need a scheduler *that can *read the Batch file *and *executes the commands *written in it at a set time. For this purpose, we will use *Windows’ Task Scheduler *will come in handy.

programming machine-learning analytics python automation

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AutoML: Automated Machine Learning | Data Science | Machine Learning | Python

AutoML makes the power of a Machine Learning algorithm available to you even if you don't have the complete knowledge of Machine Learning.You can use AutoML

Learn Python Programming

Learn Python Programming

How To Plot A Decision Boundary For Machine Learning Algorithms in Python

How To Plot A Decision Boundary For Machine Learning Algorithms in Python, you will discover how to plot a decision surface for a classification machine learning algorithm.

Learn Programming With Python In 100 Steps

Description We love Programming. Our aim with this course is to create a love for Programming. Python is one of the most popular programming languages. Python offers both object oriented and structural programming features. We take an hands-on...

Pipelines in Machine Learning | Data Science | Machine Learning | Python

Machine Learning Pipelines performs a complete workflow with an ordered sequence of the process involved in a Machine Learning task. The Pipelines can also