Creating and saving your plots for your Flask BI dashboard

In this recipe, we'll be building on previous recipes, and you'll learn how to create and save your plots to be used in your Flask business intelligence dashboard. We're adding the ability to automatically run the analysis created in IPython Notebook, and then save the generated plots for use in our dashboard.

How to do it…

  1. First, import the Python libraries that you need:
    import pandas as pd
    import numpy as np
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
  2. Next, define a variable for the accidents data file, import the data, and view the top five rows:
    accidents_data_file = '/Users/robertdempsey/Dropbox/private/Python Business Intelligence Cookbook/Data/Stats19-Data1979-2004/Accidents7904.csv' ...

Get Python Business Intelligence Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.