P O P D A T A
Blog Image

A Hundred Years of Dance Fads

  •   Audrey Taylor-Akwenye
  •   21-April 

Here's are some quick visulatizations for plotting data counts. It shows the count of Dance Fads over the last 100 years. I saw a slight increase in dance fads that coincide with changes in music consumption mediums from radio, to TV, to streaming. Below is a histogram that may better show the spikes.

Blog Image

The Code

  1. Load the Data

    Import pandas and read the csv.

    
    import pandas as pd 
    
    dances = pd.read_csv('dance.csv')
    dances["Year"].astype(int); #ensure year is interger 
    dances.head()
    
    
  2. Line Chart

    Import Seaborn and Matplotlib. The x is the index as we are doing a line plot with cumulative counts. The y is the year.

    Blog Image
     
    import seaborn as sns; sns.set()
    import matplotlib.pyplot as plt
    
    x = dances.index
    y = dances.Year
    fig = plt.figure(figsize=(8, 6))
    
    #adding plot title 
    plt.title('Dance Fad over the last 100 Years')
    
    #adding horizontal lines 
    plt.axhline(y=1926, color='y', linestyle='-')
    plt.axhline(y=1962, color='r', linestyle='-')
    plt.axhline(y=1990, color='b', linestyle='-')
    plt.axhline(y=2006, color='g', linestyle='-')
    
    #adding test to the chart
    plt.text(10, 1940, 'Radio Age')
    plt.text(40, 1970, 'TV Age')
    plt.text(60, 2000, 'MTV')
    plt.text(80, 2010, 'YouTube')
    
    ax = sns.lineplot(x=x, y=y, data=dances)
    
    plt.show()
    
    
  3. Bar Chart

    Here we create a bar chart of the top ten years for Dance Fads.

    Blog Image
     
    top_years = dances['Year'].value_counts().head(10)
    top_years.plot.barh(color='purple')
    
    plt.xlabel('Dance Fad Count')
    plt.ylabel('Year')
    
    plt.title("Top Years for Dance Fads", fontweight='bold');
    
    


Author
Audrey Taylor-Akwenye

Data Scientist, Educator, Entrepreneur