Coder Social home page Coder Social logo

ex-04-multivariate-analysis's Introduction

                                                          Ex-04-Multivariate-Analysis

AIM: To apply multivariate analysis on a give data set.

Algorithm:

1.start

2.read the dta from the file

3.clean the data a)remove outliers b)fill the null value or drop the column

4.perform multivariate analysis a)scatter plot b)box plot c)heat map

Program: read and cleaned the null value: code: import pandas as pd

df=pd.read_csv("/content/SuperStore.csv")

df['Postal Code']=df['Postal Code'].fillna(df['Postal Code'].mode()[0])

df.isnull().sum()

image

scatter plot:

df.dtypes:

code:

df.dtype

output:

image

kurtosis:

df.kurtosis()

code:

output:

image

scatter plot:

code:

import pandas as pd

import seaborn as sns

sns.boxplot(df['Sales'],df['Postal Code'])

output:

image

Bar plot:

code:

sns.barplot(x=df["Sales"],y=df["Postal Code"],data=df)

image

bar plot

code:

import pandas as pd

import seaborn as sns

import matplotlib.pyplot as plt

states=df.loc[:,["Postal Code","Sales"]]

states=states.groupby(by=["Postal Code"]).sum().sort_values(by="Sales")

plt.figure(figsize=(17,7))

sns.barplot(x=states.index,y="Sales",data=states)

plt.xticks(rotation = 90)

plt.xlabel=("Postal Code")

plt.ylabel=("Sales")

plt.show()

output:

image

code:

import pandas as pd

import seaborn as sns import matplotlib.pyplot as plt

states=df.loc[:,["State","Postal Code"]]

states=states.groupby(by=["State"]).sum().sort_values(by="Postal Code")

plt.figure(figsize=(17,7))

sns.barplot(x=states.index,y="Postal Code",data=states)

plt.xticks(rotation = 90)

plt.xlabel=("Sales")

plt.ylabel=("Postal Code")

plt.show()

output:

image

corr:

df.corr()

output:

image

Heatmap:

code:

import numpy as np

import seaborn as sn

import matplotlib.pyplot as plt

data=pd.read_csv("/content/SuperStore.csv")

data = np.random.randint(low = 1, high = 100, size = (10, 10))

print("The data to be plotted:\n")

print(data)

hm = sn.heatmap(data = data)

plt.show()

output: image

RESULT:

Thus we have applied the multiivariate analysis sucessfully

ex-04-multivariate-analysis's People

Contributors

karthi-govindharaju-ai avatar pavivenkat614 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.