My bar chart is not showing correctly. I have csv data as below. I would like to plot bar chart using group by date and categories Key value with Count. So, every date will be group by and it will categories the key value with their Count. Please assist with below code. I am new and learning python myself.
My csv collect_data.csv
data:
Date,Key,Count
14-10-2020,created,5
14-10-2020,moved,3
14-10-2020,modified,3
14-10-2020,deleted,5
17-10-2020,created,25
17-10-2020,moved,6
17-10-2020,modified,13
17-10-2020,deleted,25
18-10-2020,created,13
18-10-2020,modified,7
18-10-2020,moved,1
18-10-2020,deleted,13
My current bar chart:
My code:
import matplotlib.pyplot as plt
import pandas as pd
def display_dashboard():
try:
df = pd.read_csv("collect_data.csv")
df.head()
df['Date'].value_counts().plot(kind='bar')
plt.title('File System Changed Based on Type of Event')
plt.ylabel('Total Count of Event Occurred')
plt.xlabel("DATE")
plt.show()
except FileNotFoundError:
print("Exception error: Missing files!")