Informatics Practices
Collect data about colleges in Delhi University or any other university of your choice and number of courses they run for Science, Commerce and Humanities, store it in a CSV file and present it using a bar plot.
Answer
import pandas as pd
import matplotlib.pyplot as plt
data = {"Stream": ["Science", "Commerce", "Humanities"],
"Number of Courses": [12, 10, 15]
}
df = pd.DataFrame(data)
df.to_csv('du_colleges.csv', index=False)
df = pd.read_csv("du_colleges.csv")
plt.bar(df["Stream"], df["Number of Courses"])
plt.xlabel("Stream")
plt.ylabel("Number of Courses")
plt.title("Number of Courses in Each Stream")
plt.show()
Output

Related Questions
Plot a histogram of a class test of 40 students based on random sets of marks obtained by the students (MM=100).
A list namely temp contains average temperatures for seven days of last week. You want to see how the temperature changed in last seven days. Which chart type will you plot for the same and why ?
What is histogram ? How do you create histograms in Python ?
What are various types of histograms that can be created through hist() function ?