Code Monkey home page Code Monkey logo

odd2023-datascience-ex-08's Introduction

Ex-08-Data-Visualization-

AIM

To Perform Data Visualization on a complex 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.

PROGRAM:

Developed By: SANJAY G
Reg No: 212222230131

READING THE GIVEN FILES

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

DATA VISUALIZATION USING SEABORN :

import seaborn as sns
from matplotlib import pyplot as plt
  • LINE PLOT:
plt.figure(figsize=(9,6))
sns.lineplot(x="Segment",y="Region",data=df,marker='o')
plt.xticks(rotation = 90)
sns.lineplot(x="Category",y="Sales",data=df,marker='o')
  • 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)
  • BOXPLOT:
sns.boxplot(x="Sub-Category",y="Discount",data=df)
sns.boxplot( x="Profit", y="Category",data=df)
  • VIOLIN PLOT:
sns.violinplot(x="Profit",data=df)
  • 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)
  • POINTPLOT
sns.pointplot(x=df["Quantity"],y=df["Discount"])
  • COUNT PLOT
sns.countplot(x="Category",data=df)
sns.countplot(x="Sub-Category",data=df)
  • HISTOGRAM
sns.histplot(data=df,x ='Ship Mode',hue='Sub-Category')
  • KDE PLOT
sns.kdeplot(x="Profit", data = df,hue='Category')

DATA VISUALIZATION USING MATPLOTLIB :

  • PLOT
plt.plot(df['Category'], df['Sales'])
plt.show()
  • HEATMAP:
df.corr()
plt.subplots(figsize=(12,7))
sns.heatmap(df.corr(),annot=True)
  • 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()
  • HISTOGRAM:
plt.hist(df["Sub-Category"],facecolor="peru",edgecolor="blue",bins=10)
plt.show()
  • BARGRAPH:
plt.bar(df.index,df['Category'])
plt.show()
  • SCATTERPLOT:
plt.scatter(df["Region"],df["Profit"], c ="blue")
plt.show() 
  • BOXPLOT:
plt.boxplot(x="Sales",data=df)
plt.show()

RESULT:

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

odd2023-datascience-ex-08's People

Contributors

karthi-govindharaju avatar sanjay-sg 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.