<jupyter_start><jupyter_text>_Lambda School Data Science_ Choose appropriate visualizationsRecreate this [example by FiveThirtyEight:](https://fivethirtyeight.com/features/al-gores-new-movie-exposes-the-big-flaw-in-online-movie-ratings/)![](https://fivethirtyeight.com/wp-content/uploads/2017/09/mehtahickey-inconvenient-0830-1.png?w=575)Using this data:https://github.com/fivethirtyeight/data/tree/master/inconvenient-sequel Stretch goalsRecreate more examples from [FiveThityEight's shared data repository](https://data.fivethirtyeight.com/).For example:- [thanksgiving-2015](https://fivethirtyeight.com/features/heres-what-your-part-of-america-eats-on-thanksgiving/) ([`altair`](https://altair-viz.github.io/gallery/index.htmlmaps))- [candy-power-ranking](https://fivethirtyeight.com/features/the-ultimate-halloween-candy-power-ranking/) ([`statsmodels`](https://www.statsmodels.org/stable/index.html))<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

fake = pd.Series([38,3,2,1,2,4,6,5,5,33],index=range(1,11))
plt.style.use('fivethirtyeight')
fake.plot.bar(color = '#EC713B' ,width = 0.9);
plt.style.available
fake2 = pd.Series(
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
     2, 2, 2, 
     3, 3, 3,
     4, 4,
     5, 5, 5,
     6, 6, 6, 6,
     7, 7, 7, 7, 7,
     8, 8, 8, 8,
     9, 9, 9, 9, 
     10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10])
fake2.plot.hist();
fake2.value_counts().sort_index().plot.bar(color='#EC713B', width=0.9);
plt.style.use('fivethirtyeight')

fake = pd.Series([38, 3, 2, 1, 2, 4, 6, 5, 5, 33], 
                 index=range(1,11))

ax = fake.plot.bar(color='#EC713B', width=0.9);

ax.set(#title="'An Inconvenient Sequel: Truth to Power' is divisive",
      xlabel='Rating',
      ylabel='Perecent of total votes',
      yticks= range(0,50,10))

ax.text(x=-1.5, y=45, s="'An Inconvenient Sequal: Truth to Power' is divisive",
       fontsize=16, fontweight='bold')
ax.text(x=-1.5, y=43, s="IMDb ratings for the film as of Aug. 29")

ax.tick_params(labelrotation=0);
df = pd.read_csv('https://raw.githubusercontent.com/fivethirtyeight/data/master/inconvenient-sequel/ratings.csv')
df.shape
df.head()
pd.options.display.max_columns = None 
  #gets rid of the elipses that hides columns from .head
df.sample(1).T 
  #.sample gives random row 
  #.T transposes aka switches rows and columns
df.timestamp.describe() 
  #unreadable times
df.timestamp = pd.to_datetime(df.timestamp)
df.timestamp.describe() 
  #readable transformed times 
df.set_index('timestamp', inplace=True)
df['2017-08-29'] 
  #shows you everything that happens on that date... smart pandas!
df.info()
df.category.value_counts()
df.link.value_counts()
df[df.category=='IMDb users'] 
  #boolean indexing, != would give you all but IMDb users
lastday = df['2017-08-29']
lastday[lastday.category=='IMDb users'].respondents.plot();
final = df.tail(1)
final
columns = ['1_pct', '2_pct', '3_pct', '4_pct', '5_pct',
           '6_pct', '7_pct', '8_pct', '9_pct', '10_pct']

final[columns]
data = final[columns].T
data.index = range(1,11)
data
plt.style.use('fivethirtyeight')

ax = data.plot.bar(color='#EC713B', width=0.9, legend=False);

ax.set(#title="'An Inconvenient Sequel: Truth to Power' is divisive",
      xlabel='Rating',
      ylabel='Perecent of total votes',
      yticks= range(0,50,10))

ax.text(x=-1.5, y=45, s="'An Inconvenient Sequal: Truth to Power' is divisive",
       fontsize=16, fontweight='bold')
ax.text(x=-1.5, y=43, s="IMDb ratings for the film as of Aug. 29")

ax.tick_params(labelrotation=0);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.173402512288367, 'fraction_numerical': 0.06198798470780994, 'mean_word_length': 4.4347181008902075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 9, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '229403', 'license': 'MIT', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1404, 'n_words': 310, 'path': 'module3-make-explanatory-visualizations/LS_DS_123_Make_explanatory_visualizations.ipynb', 'repo_name': 'cheddur93/DS-Sprint-02-Storytelling-With-Data', 'size': '3662'}