0% found this document useful (0 votes)
38 views7 pages

Logs

This JSON summarizes a document describing statistical analysis of star data using Python/R. The document loads star data, performs univariate analysis with plots like pie charts and histograms, and bivariate analysis with plots like scatter plots and box plots.

Uploaded by

diyalap01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views7 pages

Logs

This JSON summarizes a document describing statistical analysis of star data using Python/R. The document loads star data, performs univariate analysis with plots like pie charts and histograms, and bivariate analysis with plots like scatter plots and box plots.

Uploaded by

diyalap01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Name : Loghitha K Y

Register Number : 913121205048


Ex.No: 02 Statistical analysis with exploratory graphs for the given data using
Date: Python/R
Aim:
To develop code to perform statistical analysis with exploratory graphs for the given data
using python / R.
Algorithm:
1. Import the dataset.
2. Use different statistical analysis by interpreting it with graphs.
3. Use Python/R to analyze it.
4. Perform univariate, bivariate and multivariate analysis for the same.

Univariate analysis:
Bar Plots:
Use bar plots to visualize the frequency distribution of a single categorical variable.
Pie Charts:
Pie charts are useful for visualizing the proportions of different categories within a
singlevariable.
Histogram:
A histogram is a graph that shows the frequency of numerical data using rectangles. The
height of a rectangle (the vertical axis) represents the distribution frequency of a variable
(the amount, or how often that variable appears)
Bivariate analysis:
Stacked Bar Plots:
Use stacked bar plots to compare the distribution of a categorical variable
across twocategories.
Multivariate analysis:

Pair Plots:
Pair plots can be used to create scatterplots between multiple categorical variables.
Program:
Importing the dataset:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048
#Load the data
df = pd.read_csv('/content/cleaned_star_data.csv')
#View the data
df.head()

1. Univariate Analysis:

(i) Pie chart:

plt.figure(figsize=(10,10))
plt.subplot(2,2,1)
plt.pie(df["Star type"].value_counts(), autopct='%.2f')
plt.title("Star type")

(ii) Histogram:

plt.hist(df["Star color"])
plt.show()

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048

(iii) Box plot:

sns.boxplot(df["Star type"])
plt.show()

(iv) Scatter plot:

plt.scatter(df.index,df['Star color'])
plt.show()

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048
(v) Bar chart:

plt.bar(df.index,df['Absolute magnitude(Mv)'])
plt.show()

Bivariate Analysis:
(i) Pie Chart

plt.figure(figsize=(10,10))
# first plot
plt.subplot(2,2,1)
plt.pie(df["Star color"].value_counts(), autopct='%.2f')
plt.title("Star color")
# second plot
plt.subplot(2,2,2)
plt.pie(df["Spectral Class"].value_counts(), autopct='%.2f')
plt.title("Spectral Class")

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048
(ii) Histogram:

plt.hist(df["Star type"])
plt.show()
plt.hist(df["Temperature (K)"])
plt.show()

(iii) Box Plot:

sns.boxplot(df["Temperature (K)"])
plt.show()
sns.boxplot(df["Spectral Class"])
plt.show()

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048

(iv) Scatter Plot:

plt.scatter(df.index,df['Luminosity(L/Lo)'])
plt.show()
plt.scatter(df.index,df['Radius(R/Ro)'])
plt.show()

21PCS02 – Exploratory Data Analysis Laboratory


Name : Loghitha K Y
Register Number : 913121205048
(v) Bar plot:

sns.barplot(x = 'Star type',y = 'Star color',data = df)


plt.show()

Result:

In this Experiment, the statistical analysis using exploratory graphs for the given data has
been executed and the output was verified successfully.

21PCS02 – Exploratory Data Analysis Laboratory

You might also like