To Perform Data Visualization on a complex dataset and save the data to a file.
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.
Read the given Data
Clean the Data Set using Data Cleaning Process
Apply Feature generation and selection techniques to all the features of the data set
Apply data visualization techniques to identify the patterns of the data.
DEVELOPED BY: HARISH RAGAVENDRA S
RESISTER NO: 212222230045
import pandas as pd
import seaborn as sns
df=sns.load_dataset("tips")
df
df.isnull().sum()
import matplotlib.pyplot as plt
plt.figure(figsize=(7,7))
plt.title("Data with outliers")
df.boxplot()
plt.show()
cols=['size','tip','total_bill']
q1=df.quantile(0.75)
q3=df.quantile(0.25)
iqr=q3-q1
low=q1+1.5*iqr
high=q3-1.5*iqr
df2=df[(df[cols]>low)&(df[cols]<high)]
df2
df2=df2.drop(['sex','smoker','day','time'],axis=1)
df2
import seaborn as sns
import matplotlib.pyplot as plt
sns.barplot(x=df["day"],y=df["total_bill"],hue=df["day"])
plt.title("TOTAL BILL VS DAY")
plt.show()
sns.barplot(x=df["smoker"],y=df["tip"],hue=df["day"])
plt.title("What is the average tip amount given by smokers and non-smokers")
plt.show()
df["tip_percent"] = df["tip"] / df["total_bill"]
sns.scatterplot(x=df['size'],y=df['tip_percent'],data=df)
plt.title("Tip Percentage by Dining Party Size")
sns.boxplot(x=df['sex'], y=df['tip'],hue=df['sex'])
plt.title("Tips based on gender")
sns.scatterplot(x=df['day'],y=df['total_bill'],hue=df['day'])
plt.legend(loc="best")
plt.title("Total bill amount by day of the week")
sns.histplot(data=df, x="total_bill", hue="time", element="step", stat="density")
plt.title("Distribution of Total Bill Amounts by Time of Day")
sns.barplot(x=df['size'],y=df['total_bill'],hue=df['size'])
plt.title("Average Total Bill Amount by Dining Party Size")
plt.show()
sns.boxplot(x="day", y="tip", data=df)
plt.title("Tip Amount by Day of Week")
plt.show()
sns.violinplot(x="time", y="tip", data=df)
plt.title("Tip Amount by Time of Day")
plt.show()
sns.scatterplot(x="total_bill", y="tip", data=df)
plt.title("Correlation between Tip Amount and Total Bill Amount")
plt.show()
Thus the experiment executed sucessfully.