To read the given data and perform the univariate analysis with different types of plots.
1)Read the given data.
2)Perform data cleaning process.
3)Visulaize and analyse the data using various plots.
DEVELOPED BY:GURUMOORTHI R
REG NO:212222230042
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
df=pd.read_csv("/content/iris (1).csv")
df.head()
df.tail()
df.nunique()
df.iloc[:,4].value_counts()
for i in range(0,df.shape[1]):
print("-----------",df.columns[i],"------------")
print(df.iloc[:,i].value_counts())
print("---------------------------------------")
sns.countplot(x='species',data=df)
dfv=df.loc[df['species']=='virginica']
plt.plot(dfv['sepal_length'],np.zeros_like(dfv['sepal_length']),'*')
plt.xlabel('sepal length')
plt.show()
dfs=df.loc[df['species']=='setosa']
dfc=df.loc[df['species']=='versicolor']
plt.plot(dfs['sepal_length'],np.zeros_like(dfs['sepal_length']),'*')
plt.plot(dfc['sepal_length'],np.zeros_like(dfc['sepal_length']),'X')
plt.plot(dfv['sepal_length'],np.zeros_like(dfv['sepal_length']),'o')
plt.plot(dfs['sepal_length'],np.zeros_like(dfs['sepal_length']),'+')
plt.plot(dfc['sepal_length'],np.zeros_like(dfc['sepal_length']),'-')
plt.xlabel('SEPALLENGTH')
plt.show()
Thus the univariate analysis can be implemented successfully.