My Code (in Jupyter Notebook):
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
unrate = pd.read_csv("unemployment-rate_csv.csv")
unrate.columns = ["DATE","VALUE"]
unrate["DATE"] = pd.to_datetime(unrate["DATE"])
first_12 = unrate[:12]
plt.plot(first_12["DATE"],first_12["VALUE"])
plt.xticks(rotation=90)
plt.xlabel("Month")
plt.ylabel("Unemployment Rate")
plt.title("Monthly Unemployment Trends, 1948")
plt.show()
What I expected to happen:
Display all x-labels for the 12 months of the year 1948.
What actually happened:
Only every 2nd label was shown: 1948-01, 1948-03, 1948-05, etc
I tried to replicate the unemployment rate line chart from the course “Line Charts” in Jupyter Notebook. I used the same code as in the DQ-environment but the number of x-labels was not the same. How can I display them all?
Thanks.