In [7]:
import pandas as pd
import matplotlib.pyplot as plt
# Load your CSV file
df = pd.read_csv("datasets/data.csv")
# Show the first few rows
print(df.head())
# -----------------------------
# 1. LINE PLOT
# -----------------------------
plt.figure(figsize=(8,5))
plt.plot(df[df.columns[0]], df[df.columns[1]])
plt.xlabel(df.columns[0])
plt.ylabel(df.columns[1])
plt.title("Line Plot")
plt.show()
# -----------------------------
# 2. BAR CHART
# -----------------------------
plt.figure(figsize=(8,5))
plt.bar(df[df.columns[0]], df[df.columns[1]])
plt.xlabel(df.columns[0])
plt.ylabel(df.columns[1])
plt.title("Bar Chart")
plt.show()
# -----------------------------
# 3. HISTOGRAM
# -----------------------------
plt.figure(figsize=(8,5))
plt.hist(df[df.columns[1]], bins=10)
plt.xlabel(df.columns[1])
plt.title("Histogram")
plt.show()
# -----------------------------
# 4. SCATTER PLOT
# -----------------------------
plt.figure(figsize=(8,5))
plt.scatter(df[df.columns[0]], df[df.columns[1]])
plt.xlabel(df.columns[0])
plt.ylabel(df.columns[1])
plt.title("Scatter Plot")
plt.show()
percentage of alcohol consumption by dzongkhag wise Unnamed: 1 0 Dzongkhag percentage 1 bumthang 21.8 2 chukha 30.7 3 dagana 31.3 4 gasa 23.8