Program-5
Write a program to Visualize the dataset to gain insights using Matplotlib
or Seaborn by plotting scatter plots, bar charts.
Source Code:
import pandas as pd
import [Link] as plt
#define the file path:
csv_file_path = 'C:\\Users\\ravik\\venv\\Lab_Programs\\[Link]'
#load the data
data= pd.read_csv(csv_file_path)
data_df=[Link](data)
print("CSV File Data")
print(data)
#Scatter plot of Reading score and placement score
[Link](figsize=(14,7))
[Link](1,2,1) # 1row, 2coloumns, 1st subplot
[Link](data['Reading_Score'], data['Placement_Score'], color='dodgerblue', edgecolor='k',
alpha=0.7)
[Link]('Reading Score Vs Placement Score')
[Link]('Reading Score')
[Link]('Placement Score')
[Link](True)
#Bar chart of Average Placement Score by Reading Score range
bins = [40, 50, 60, 70, 80, 90, 100]
labels = ['40-50', '50-60', '60-70', '70-80', '80-90', '90-100']
data['Reading Score Range']= [Link](data['Reading_Score'], bins=bins, labels=labels, right=False)
group_data = [Link]('Reading Score Range')['Placement_Score'].mean()
[Link](1,2,2) #1Row, 2Columns, 2nd Subplot
group_data.plot(kind='bar', color='salmon')
[Link]('Average Placement Score by Reading Score Ramge')
[Link]('Reading Score Range')
[Link]('Average Placement Score')
[Link](rotation=0) #Keep the category labels horizontal
plt.tight_layout() #Adjust subplots to fit into figure area.
[Link]()