IPO’s Of Indian Stock Market (2010–2021) Data Visualization and Analysis In Python

Top IPO gainers. IPO Buy Month. IPOs launch in the year 2021. Which IPO sector is booming?

Rohit Kumar Thakur
Geek Culture

--

Data Analysis and Visualization Of IPO

Hello, Data Scientists!

Jeff Bezos said that the 21st century is of India’s. Well, he is right. Indian stock market is the most profitable stock market in the past few years. Everyone wants to do invest in the Indian Stock Market.

In this article, we are going to do some visualization and analysis of all the IPOs of the Indian Stock Market which hit the market after the year 2010. If you are a beginner, don’t worry. I will go step by step. So let’s start this project with a cup of coffee.

Attention all developers seeking to make social connections and establish themselves while earning passive income — look no further! I highly recommend ‘From Code to Connections’, a book that will guide you through the process. Don’t miss out, grab your copy now on Amazon worldwide or Amazon India! You can also go for Gumroad

If you are looking for a video tutorial then it’s here:

Initial public offering(IPO)

According to Wikipedia, An initial public offering or stock launch is a public offering in which shares of a company are sold to institutional investors and usually also retail investors. An IPO is typically underwritten by one or more investment banks, who also arrange for the shares to be listed on one or more stock exchanges.

The link to download the dataset is available at the end of this article.

You can write the Python code in Jupyter Notebook, Google Colab, or any other preferred editor. I will recommend you to use Google Colab because it is easy to use and reliable.

Code & Analysis

  • Import the libraries
#for mathematical computationimport numpy as np
import pandas as pd
import scipy.stats as stats
#for data visualizationimport seaborn as sns
import matplotlib.pyplot as plt
import plotly
import plotly.express as px
from matplotlib.pyplot import figure
% matplotlib inline
  • Let’s load the data and take a sneak peek at the data
df = pd.read_csv("/content/IPO.csv", encoding='latin-1')
df.head()
Data Analysis and Visualization Of IPO

We have the IPO Name, IPO issue size, price of the open listing, listing close price, the current market price of each IPO, current gains in percentage, QIB, HNI, and RII.

  • Gather some more information of data
df.info()
df.describe()

Check out the null values in each column. We got lucky that there are no null values in our dataset.
After that, get more information about our dataset with the type of each column attributes.

  • Heatmap
f,ax = plt.subplots(figsize=(14,10))
sns.heatmap(df.corr(), annot=True, fmt=".2f", ax=ax)
plt.show()
Data Analysis and Visualization Of IPO

High Net-worth Individual(HNI) is very positively correlated to Qualified institutional buyer (QIB)

Retail individual investor (RII) is very positively correlated to HNI.

The issue price is highly positively correlated to Listing open and listing close.

  • Data cleaning
date = df.Date.str.split('-', expand =True)
df['year'] = date[2]
df['month'] = date[1]
df['day'] = date[0]
df.year = pd.to_numeric(df.year)
df.month = pd.to_numeric(df.month)
df.day = pd.to_numeric(df.day)

I just want to get a separate column for the year, date, and month of IPO launch. To do that, I wrote the above code. Now, our data is a little bit changed. When you see the top 5 data then you will notice that we have 3 new columns.

df.head()
Data Analysis and Visualization Of IPO
  • Year-wise IPO launch
fig1 = px.pie(df, names='year')
fig1.show()
Data Analysis and Visualization Of IPO

After the year 2010, the year 2021 registers the most launch of IPOs in India. Some experts say that more IPOs hit the market when the market is very bullish. We all know that right now Indian Stock Market is very bullish.

  • Relation of Month with IPOs launch
fig2 = px.pie(df, names='month')
fig2.show()
Data Analysis and Visualization Of IPO

October has the highest number of IPOs launched. But the month doesn't tell anything more specific. The listing of IPO is almost equal in each month except January and June.

  • WordCloud
from wordcloud import WordCloud
wordCloud = WordCloud().generate(' '.join(df.IPO_Name))
plt.figure(figsize=(15,7))
plt.axis('off')
plt.imshow(wordCloud, interpolation='bilinear')
plt.show()
Data Analysis and Visualization Of IPO

We use the word cloud to display the visuals of text data. Word Clouds display the most prominent or frequent words in a body of text.

  • Top gainers in Percentage at the time of Listing.
top_gainer = df.groupby('IPO_Name').sum().sort_values('Listing_Gains(%)', ascending=False).head(20)
top_gainer = top_gainer.reset_index()
px.bar(x='IPO_Name', y ="Listing_Gains(%)", data_frame=top_gainer)
Data Analysis and Visualization Of IPO

Sigachi Ind listed with whooping 270.4% of the gain. I mean that’s huge. Paras defence also opens with a gain of 185%. If you got allotted to any of these stocks then let me know in the comment section. Let’s know more about Sigachi Ind:

x = df[df['IPO_Name'] == 'Sigachi Ind']
x

It is launched on 15th November 2021. How I missed that. Okay, I am not crying :( The issued price of this IPO was Rs. 163. It opened at Rs. 575 and closes at Rs. 603.75.

  • Top Losers in Percentage at the time of Listing.
top_loser = df.groupby('IPO_Name').sum().sort_values('Listing_Gains(%)', ascending=True).head(20)
top_loser = top_loser.reset_index()
px.bar(x='IPO_Name', y ="Listing_Gains(%)", data_frame=top_loser)
Data Analysis and Visualization Of IPO

VKS Projects are listed on the Indian Stock Market with a loss of 97.15%. I hope these IPOs were not allotted to you.

If you want to know more about VKS projects then you can do this in the following way:

x2 = df[df['IPO_Name'] == 'VKS Projects']
x2
  • Current Top Gainers
current_top_gainers = df.groupby('IPO_Name').sum().sort_values('Current_gains', ascending=False).head(20)
current_top_gainers = current_top_gainers.reset_index()
px.bar(x='IPO_Name', y ="Current_gains", data_frame=current_top_gainers)
Data Analysis and Visualization Of IPO

Jubilant Food tops the chart with a whopping 2578% gain. It was listed in the year 2010. If you are a long-term investor then this chart is for you.

  • Company’s IPO size (in crores)
issue_size = df.groupby('IPO_Name').sum().sort_values('Issue_Size(crores)', ascending=False).head(20)
issue_size = issue_size.reset_index()
px.bar(x='IPO_Name', y ="Issue_Size(crores)", data_frame=issue_size)
Data Analysis and Visualization Of IPO

Paytm IPO was the most hyped IPO I have ever seen. But unfortunately, it didn't go well. The IPO size of coal India is also huge. But there is no future in coal. So, if you are an investor then you have to keep this in your mind.

  • IPO Listed in the year 2021
x4 = df[df['year'] == 21]
x4

Run this code and you will see that there is a total of 51 IPOs listed in the year 2021.

Well, that’s it for this article.

If this article sounds informative to you, make sure to follow and share it with your geek community.

The Google Colab link to the Code is here.

You can download the dataset from this link

Hello, My Name is Rohit Kumar Thakur. I am open to freelancing. I build react native projects and currently working on Python Django. Feel free to contact me at (freelance.rohit7@gmail.com)

--

--