Type hints are used to mention the expected data type of the variable.

Even before Python 3.6, developers provide preferred data type in comments. So that the same variable may not be used with different datatype in further enhancements.

After Python 3.6, Type hints were introduced.

Why we need to use Type Hints?

Reason #1:

Type hints can be used mention data type of a variable.

Syntax:

<variable_name>: <expected data type>

Example:

amount: int = 1000

We can also declare a variable using type hint alone without even defining the values.

Example:

total_amount: int 
sales_1 = 100
sales_2 = 200
total_amount = sales_1 + sales_2

Type hints will never…


There may be situations, where we may need to dynamically place a value in a sub string of a string.

You may think it is easy that we can concatenate strings.

For example: “The patient name is “ + patient_name + “ and age is “ + patient_age

But Python provides a beautiful way where you can even format the patient_name and patient_age to align, pad spaces or any special characters, in case of float values, we can also format decimal places.

The string object’s format function will format the given values in specified formats and place them inside the…


In this article we are going to explore the code of basic NLP operations using NLTK and spaCy.

NLTK

NLTK is an open-source library and it is very suitable for teaching, and working in, computational linguistics using Python.

Also it is having industrial strength libraries.

spaCy

spaCy is an open-source library for advanced NLP in python.

It is specially designed for production use, which can handle large volume of text where as NLTK and CoreNLP were created specially for teaching and research purpose.

spaCy provides advanced NLP techniques which is widely used in complex applications such as text summarization, text to speech…


Photo by Hari Nandakumar on Unsplash

In our previous post A Tip A Day — Python Tip #7: OpenCV — CV2: imread() and resize(), we have explored a simple image and its pixel values.
The pixel values can range from 0 to 256. Each number represents a color code.
When using the image as it is and passing through a Deep Neural Network, the computation of high numeric values may become more complex.
To reduce this we can normalize the values to range from 0 to 1.

In this way, the numbers will be small and the computation becomes easier and faster.
As the pixel values range…


Photo by Hari Nandakumar on Unsplash

In this article we are going to learn some of the major use of OpenCV or CV2.

OpenCV is a library mainly used to read/write and manipulate images.

You can find the official page here https://pypi.org/project/opencv-python/.

Installation: pip install opencv-python

Importing Library: import cv2

Supported Versions: 3.6, 3.7, 3.8, 3.9

Basic understanding of image:

We all know that an image is nothing but an array of pixels.
Each pixel is a number.

Based on the number the color of the pixel will be.

Example: 0 — Black and 1 — White.

Read Image: cv2.imread()

Lets consider we have a small image of 28 X 28 pixels.

import…


Hello Everyone!!! Its an immense pleasure to write today as this is the first post I am able to write in 2021. Happy New Year!!! 🥳 🎂 🎉

In this article we are going to see the continuation of Deep Learning techniques. We are going to see an Deep Learning model with a Classification Example.

In our last article, we learned about use a simple Neural Network to solve regression problems — Artificial Neural Network Explained with an Regression Example.

If you missed the prequels, please check below:

Artificial Intelligence — A brief Introduction and history of Deep Learning

How…


In this article, we are going to discuss about the basics of Implementing a simple Artificial Neural Network (ANN).

It is recommended to know how Artificial Neurons mimic Neurons of human brain. Please read this article for easy understanding. If you are excited to know about the history of ANN, please check this article.

Architecture Of ANN:

The architecture of ANN contains 4 main components.

Input Layer receives input:

Input layer is a set of nodes which takes the input data as one per node. …


Pandas concat & append works like an array concatenation either column wise or row wise.

But Merge & Join works similar to Database table joins. Lets see Merge in this article and learn about Join in next post!

So, Merge can be used when we need to join two data frames having different columns and there is a key column in both the data frames.

For example, if we have two data frames, one with store details and another with product details of all the stores, we can merge the data frames using shop Id.

Signature:
pd.merge(left,
right,
how: str = ‘inner’,
on=None,
left_on=None,
right_on=None,
left_index: bool…


In this article we are going to learn about Concat & Append and the comparision between these two functions.

Concat Vs Append — Image by Author
import pandas as pd

Lets take 2 dataframes of fruits.

fruit = { 'orange' : [3,2,0,1], 'apple' : [0,3,7,2], 'grapes' : [7,14,6,15] } 
df1 = pd.DataFrame(fruit)
df1

Output:


Photo by Gaelle Marcel on Unsplash

Have you ever wished to see a progress bar in Jupyter Notebook when executing a complex function in for loop?

Its possible in Python.

There is a package tqdm which allows us to show progress bar.
Also it is simple to use!!!

While implementing a for loop wrap around the iterable object using the function tqdm to show the progress of the for loop execution.

Lets see how to do it.

As we are going to use a simple for loop of 10 numbers using range(), lets use a sleep method to slower the process. …

Asha Ponraj

Data Science & Machine Learning Enthusiast | Software Developer | Blog Writer | https://devskrol.com/ | www.linkedin.com/in/asha-ponraj-a5a76b50

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