Python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Step 1: Create a DataFrame with 100 rows and 1 column
data = pd.DataFrame({
    'Values': np.random.randint(1, 100, size=100)  # Random integers between 1 and 100
})

# Display the first few rows of the DataFrame
print(data.head())  

# Step 2: Create Visualizations

# 1. Bar Diagram
value_counts = data['Values'].value_counts()

plt.figure(figsize=(10, 5))  # Set figure size
plt.bar(value_counts.index, value_counts.values, color='blue')
plt.title('Bar Diagram of Values')
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.xticks(rotation=90)  # Rotate x-axis labels for better visibility
plt.show()

# 2. Histogram
plt.figure(figsize=(10, 5))  # Set figure size
plt.hist(data['Values'], bins=10, color='green', alpha=0.7)
plt.title('Histogram of Values')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.show()

# 3. Pie Chart
plt.figure(figsize=(10, 5))  # Set figure size
value_counts = data['Values'].value_counts()
plt.pie(value_counts, labels=value_counts.index, autopct='%1.1f%%', startangle=140)
plt.title('Pie Chart of Values')
plt.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.
plt.show()
Values
0      90
1      72
2      57
3      37
4      52