Coder Social home page Coder Social logo

ex-08-data-visualization-'s Introduction

Ex-08-Data-Visualization-

AIM

To Perform Data Visualization on the given dataset and save the data to a file.

Explanation

Data visualization is the graphical representation of information and data. By using visual elements like charts, graphs, and maps, data visualization tools provide an accessible way to see and understand trends, outliers, and patterns in data.

ALGORITHM

STEP 1

Read the given Data

STEP 2

Clean the Data Set using Data Cleaning Process

STEP 3

Apply Feature generation and selection techniques to all the features of the data set

STEP 4

Apply data visualization techniques to identify the patterns of the data.

CODE

#Reading the given dataset

import pandas as pd
df=pd.read_csv("Superstore.csv",encoding='unicode_escape')

df.head()

#Data Visualization using Seaborn

import seaborn as sns
from matplotlib import pyplot as plt

#1.Line Plot

plt.figure(figsize=(9,6))
sns.lineplot(x="Segment",y="Region",data=df,marker='o')
plt.xticks(rotation = 90)

sns.lineplot(x='Ship Mode',y='Category', hue ="Segment",data=df)

sns.lineplot(x="Category",y="Sales",data=df,marker='o')

#2.Scatterplot

sns.scatterplot(x='Category',y='Sub-Category',data=df)

sns.scatterplot(x='Category', y='Sub-Category', hue ="Segment",data=df)

plt.figure(figsize=(10,7))
sns.scatterplot(x="Region",y="Sales",data=df)
plt.xticks(rotation = 90)

#3.Boxplot

sns.boxplot(x="Sub-Category",y="Discount",data=df)

sns.boxplot( x="Profit", y="Category",data=df)

#4.Violin Plot

sns.violinplot(x="Profit",data=df)

#5.Barplot

sns.barplot(x="Sub-Category",y="Sales",data=df)
plt.xticks(rotation = 90)

sns.barplot(x="Category",y="Sales",data=df)
plt.xticks(rotation = 90)

#6.Pointplot

sns.pointplot(x=df["Quantity"],y=df["Discount"])

#7.Count plot

sns.countplot(x="Category",data=df)

sns.countplot(x="Sub-Category",data=df)

#8.Histogram

sns.histplot(data=df,x ='Ship Mode',hue='Sub-Category')

#9.KDE Plot

sns.kdeplot(x="Profit", data = df,hue='Category')

#Data Visualization Using MatPlotlib

#1.Plot

plt.plot(df['Category'], df['Sales'])
plt.show()

#2.Heatmap

df.corr()
plt.subplots(figsize=(12,7))
sns.heatmap(df.corr(),annot=True)

#3.Piechart

df1=df.groupby(by=["Ship Mode"]).sum()
labels=[]
for i in df1.index:
    labels.append(i)
colors=sns.color_palette("bright")
plt.pie(df1["Sales"],labels=labels,autopct="%0.0f%%")
plt.show()

df3=df.groupby(by=["Category"]).sum()
labels=[]
for i in df3.index:
    labels.append(i) 
plt.figure(figsize=(8,8))
colors = sns.color_palette('pastel')
plt.pie(df3["Profit"],colors = colors,labels=labels, autopct = '%0.0f%%')
plt.show()

#4.Histogram

plt.hist(df["Sub-Category"],facecolor="peru",edgecolor="blue",bins=10)
plt.show()

#5.Bargraph

plt.bar(df.index,df['Category'])
plt.show()

#6.Scatterplot

plt.scatter(df["Region"],df["Profit"], c ="blue")
plt.show() 

#7.Boxplot

plt.boxplot(x="Sales",data=df)
plt.show()

OUPUT

Reading the given dataset

171088128-126c7176-a343-4f0d-9775-be64ef025be9

Data Visualization Using Seaborn:

1.Line Plot

171088148-00745931-00a9-4e77-9652-bde07ec58041

171088166-0622ed0d-983e-4fbb-9a07-ffde6ae73fbf

171088179-9468b1ae-1975-4ddd-8c7d-15a62cde1105

2.Scatterplot

171088199-43c1ab2b-8c36-4787-a25b-9fb447afb27a

171088208-7f3a8cdd-e757-4d86-8366-8e7795a10be1

171088221-0b5ce909-ea1b-4d11-b544-02a182ae71f8

3.Boxplot

171088266-a16dba86-8fc1-4f39-a43e-8946245952ed

171088275-5fc74eac-6c9c-4751-9a25-a6bb396b51b0

4.Violin Plot

171088288-b57cfa86-14ca-4da3-be85-2aedda3ef070

5.Barplot

171088300-2f65fe18-2157-4408-93b9-621db48d3fe5

171088309-f8fc728a-98de-46da-af45-5504501865a5

6.Pointplot

171088319-54fd42f2-c10d-4696-ab1d-cf26b67876ab

7.Count plot

171088340-ac5e9f66-7ecd-4fbc-b58f-0e8a9c854f58

171088373-3b644c23-eb34-4c62-9854-7beedc247c8e

8.Histogram

171088392-27dc5b70-ca70-4069-ac16-50edbcb51fb0

9.KDE Plot

171088402-28a45721-eef1-44ae-8a71-8f1cdfc84371

Data Visualization Using Matplotlib:

1.Plot

171088777-b33aa92c-b4f2-4b2e-af45-c86899df03c9

2.Heatmap

171088793-a39c19c3-f481-4837-a9ab-c59bbbb80b72

3.Piechart

171088813-8407fd7d-2c62-41f5-9e0d-25242f9576ac

171088875-f1b23ed9-0c39-4061-aeeb-bd21c3943308

4.Histogram

171088893-37660289-6bfa-4274-94b9-f9c10373a8a4

5.Bargraph

171088899-506a8bfe-128b-44a6-aea9-6ad9d68d27e7

6.Scatterplot

171088911-4bc14fcd-490e-40bc-a732-d8e733ca4713

7.Boxplot

171088927-6bb49da4-25fe-4f10-8dab-11a1f0b68c88

RESULT

Hence,Data Visualization is applied on the complex dataset using libraries like Seaborn and Matplotlib successfully and the data is saved to file.

ex-08-data-visualization-'s People

Contributors

karthi-govindharaju avatar aravindroman07 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.