Course Name : Data Visualization and Business Intelligence
Date : 17 Aug 2024
Lab Assignment - 2
Name : Aelishala Manoj
Registation no : 2303A54054
Batch no : 47
Q) You have been provided with a CSV file named csv, which contains sales data for different products over multiple weeks. Your task is to use
Pandas and Matplotlib to read the CSV file and create a stacked bar chart that shows the total sales for each week, broken down by product
category. Make sure to include a legend, axis labels, and a title to clearly convey the sales trends across the weeks.
import pandas as pd
import [Link] as plt
df = pd.read_csv("/content/drive/MyDrive/DA dataset heights/[Link]")
[Link]()
[Link](kind='bar',x='Days',title='Mela Sales Repoort')
[Link]('sales in Rs')
[Link]()
Q) Create a sample heatmap chart on student performance
-->Note that - heatmap showing student performance across different subjects. Each cell in the heatmap represents a student's score in a
particular subject, with the color indicating the performance level.#The color ranges from light yellow (lower scores) to dark blue (higher
scores).
import pandas as pd
import seaborn as sns
import [Link] as plt
data = {
'Student': ['John', 'Jane', 'Mike', 'Emma', 'Lucy'],
'Math': [88, 78, 91, 84, 79],
'Science': [92, 85, 89, 87, 80],
'English': [85, 90, 82, 91, 84],
'History': [79, 88, 93, 85, 81],
'Art': [95, 76, 89, 88, 83]
}
df = [Link](data)
df.set_index('Student', inplace=True)
[Link](figsize=(10, 6))
[Link](df, annot=True, cmap="YlGnBu", cbar=True)
[Link]('Student Performance Heatmap')
[Link]()
Q) You are tasked with analyzing the daily ticket sales for a week-long event. You have data on the number of tickets sold each day. Create a bar
chart using Matplotlib to visualize the day-wise distribution of ticket sales. Label the axes, provide a suitable title, and use different colors for
each bar to make the chart visually appealing and easy to interpret. x=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
y=[2000,2800,3000,2500,2300,2500,1000]
import pandas as pd
import [Link] as plt
x = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
y = [2000,2800,3000,2500,2300,2500,1000]
[Link](x,y,color="magenta",marker ="*", label = "[Link] tickets")
[Link]("Day wise Tickets sold")
[Link]("Days")
[Link]("[Link] tickets sold")
[Link]()
[Link](True)
#[Link]("d:/ [Link]")
[Link]()