Sign in

Virtual reality Developer and pursuing MTech in Data Science and Machine Learning having 5+ years of industrial experience.

Part 3 of how to deploy a machine learning model with Flask in Python

In the last part we have seen, how to pass the data(string, number, float). This part will see how to use if condition within webpage.

Pass the data (0 or 1) in the server file

from flask import Flask, render_template, requestapp = Flask(__name__)
def before_submit():
return render_template(‘BasicWeb.html’, data=0)…

Part 2 of how to deploy a machine learning model with Flask in Python.

Photo by Shahadat Rahman on Unsplash

Send the data from the server file to the web page and display the data on the webpage.

We need to pass the data when we are rendering the HTML page from Python.

Now let’s see how to pass the string value from the server file.

Look at the below…

How to deploy a machine learning model with Flask in Python — Part 1

Photo by Kevin Ku on Unsplash

Let’s start with Flask and later, we will deploy the ML model using Flask locally.

Let’s see how to run Flask with a basic HTML page.

I’m creating a Python file named “”

from flask import Flask, render_template, requestapp = Flask(__name__)
def before_submit():
return render_template(‘BasicWeb.html’)

if __name__ == ‘__main__’…

Connect excel data sheets with tableau and visualize

Connect Excel with Tableau

Let’s connect the Superstore dataset into tableau. This excel file has three sheets named as Orders, People, Returns.

First open the tableau tool.

Bar chart race used to animate the data

Example:- Bar chart animation


  • pip install bar_chart_race


  • conda install -c conda-forge bar_chart_race

Install the bar_chart_race plugin using the above command.

Import plugins

import pandas as pdimport numpy as npimport bar_chart_race as bcr

Import panda, numby and bar_chart_race


Currently i’m taking dataset of covid19 day wise. Reference:- Day_wise CSV

Read the csv file and display the top 5 data


MySQL is an open-source relational database management system. Let’s look at the advantages of using MySQL and some commonly used queries.

Advantages of MySQL

  1. Open Source
  2. High Performance
  3. Low Cost
  4. Cross platform compatibility
  5. Usability
  6. Scalability
  7. Reliability
  8. Easy to use and maintain

Let’s look at some of the commonly used queries.

The NTILE() function divides rows in a sorted partition into a specific number of groups. Each group is assigned a bucket number starting at one. For each row, the NTILE() function returns a bucket number representing the group to which the row belongs.

NTILE() Syntax

NTILE(buckets) OVER ( [PARTITION BY partition_expression, … ] ORDER BY sort_expression [ASC | DESC], … )


Currently we have Account details data which has 10 rows.

SELECT * FROM account_details;

Divide given data into two groups

SELECT *,NTILE(2) OVER (ORDER BY acc_id) from account_details;

The NTH_VALUE() is a window function that allows you to get a value from the Nth row in an ordered set of rows.


NTH_VALUE(expression, N) FROM FIRST OVER ( partition_clause order_clause frame_clause )

Data Set

Here we are trying to use HR data which has ID, Name and…

SQLAlchemy supports multiple database clients using dialects/engines

Complete list of dialects supported click here

create_engine accepts data source name (dsn) as parameter

Parts of dsn


Since we are using MySQL scheme is mysql

Note :- host is mysql in our case since it was running in docker usually it will be…


  1. ASCII — This function returns the ASCII value of given character

SELECT ASCII(‘A’) — This gives the result of “65”


  1. CHAR_LENGTH() or CHARACTER_LENGTH() — Both function can be used and both returns the length of the string, “it counts space also as a value”.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store