Detailed_Python_Exam_Notes
Detailed_Python_Exam_Notes
1. Data Visualization
Data Visualization is the graphical representation of data to help understand trends, patterns, and
outliers. Python offers several libraries such as matplotlib, seaborn, and plotly to visualize data.
Example:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.title('Line Plot')
plt.show()
2. Matplotlib Plotting
Matplotlib is a powerful library for creating static, animated, and interactive visualizations. It supports
many plot types:
- Line
- Bar
- Histogram
- Scatter
Example:
plt.bar(['A', 'B', 'C'], [5, 7, 3])
plt.xlabel('Category')
plt.ylabel('Values')
plt.title('Bar Chart')
plt.show()
4. Seaborn vs Matplotlib
Matplotlib provides low-level functions for custom plots, while Seaborn is high-level and produces
attractive visuals easily.
Seaborn handles dataframes well, has themes, and complex plots like violin and heatmaps with
simple commands.
5. Histogram in Matplotlib
A histogram shows the distribution of numeric data. It divides data into bins and counts occurrences.
Example:
plt.hist([10, 20, 20, 30], bins=3, edgecolor='black')
plt.title('Histogram')
plt.show()