0% found this document useful (0 votes)
4 views2 pages

10 (3146)

The document contains Python code that utilizes the Seaborn and Matplotlib libraries to analyze the Iris dataset. It includes loading the dataset, displaying its structure, and creating histograms and boxplots for various features. Additionally, it renames the columns of the dataset for clarity.

Uploaded by

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

10 (3146)

The document contains Python code that utilizes the Seaborn and Matplotlib libraries to analyze the Iris dataset. It includes loading the dataset, displaying its structure, and creating histograms and boxplots for various features. Additionally, it renames the columns of the dataset for clarity.

Uploaded by

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

Name:Rahul Jadhav

Roll No:-3230
import seaborn as sns
import matplotlib.pyplot as plt

df =sns.load_dataset('iris')

df

sepal_length sepal_width petal_length petal_width species

0 5.1 3.5 1.4 0.2 setosa

1 4.9 3.0 1.4 0.2 setosa

2 4.7 3.2 1.3 0.2 setosa

3 4.6 3.1 1.5 0.2 setosa

4 5.0 3.6 1.4 0.2 setosa

... ... ... ... ... ...

145 6.7 3.0 5.2 2.3 virginic


a
146 6.3 2.5 5.0 1.9 virginic
a
147 6.5 3.0 5.2 2.0 virginic
a
148 6.2 3.4 5.4 2.3 virginic
a

150 rows × 5 columns

df.columns

Index(['sepal_length', 'sepal_width', 'petal_length',


'petal_width', 'species'],
dtype='object')

fig, axes = plt.subplots(2, 2, figsize=(16, 9))


sns.histplot(df['sepal_length'],ax=axes[0,0])
sns.histplot(df['sepal_width'],ax=axes[0,1])
sns.histplot(df['petal_length'],ax=axes[1,0])
sns.histplot(df['petal_width'],ax=axes[1,1])

<Axes: xlabel='petal_width', ylabel='Count'>


fig, axes = plt.subplots(2, 2, figsize=(16, 9))
sns.boxplot(y='sepal_length',x='species',data=df,ax=axes[0,0])
sns.boxplot(y='sepal_length',x='species',data=df,ax=axes[0,1])
sns.boxplot(y='sepal_length',x='species',data=df,ax=axes[1,0])
sns.boxplot(y='sepal_length',x='species',data=df,ax=axes[1,1])
<Axes: xlabel='species', ylabel='sepal_length'>

df.columns=['col1','col2','col3','col4','col5']
df.head()

col1 col2 col3 col4 col5

0 5.1 3.5 1.4 0.2 setosa

1 4.9 3.0 1.4 0.2 setosa

2 4.7 3.2 1.3 0.2 setosa

3 4.6 3.1 1.5 0.2 setosa


4 5.0 3.6 1.4 0.2 setosa

You might also like