# Run the following to import necessary packages and import dataset. Do not use any additional plotting libraries.

import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib.style.use('ggplot')

d1 = "dataset/sales1.csv"
d2 = "dataset/sales2.csv"
d3 = "dataset/sales3.csv"
d4 = "dataset/sales4.csv"

df1 = pd.read_csv(d1)
df2 = pd.read_csv(d2)
df3 = pd.read_csv(d3)
df4 = pd.read_csv(d4)
df1.head(n=5)   # Print n number of rows from top of dataset

"""
Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#Sales" data-toc-modified-id="Sales-1">Sales</a></span><ul class="toc-item"><li><ul class="toc-item"><li><span><a href="#Instructions-/-Notes:" data-toc-modified-id="Instructions-/-Notes:-1.0.1">Instructions / Notes:</a></span></li></ul></li><li><span><a href="#Each-of-the-4-dataframes-loaded-above-represents-a-company's-average-sales-over-time.-Check-the-descriptive-statistics-below." data-toc-modified-id="Each-of-the-4-dataframes-loaded-above-represents-a-company's-average-sales-over-time.-Check-the-descriptive-statistics-below.-1.1">Each of the 4 dataframes loaded above represents a company's average sales over time. Check the descriptive statistics below.</a></span></li><li><span><a href="#Clue" data-toc-modified-id="Clue-1.2">Clue</a></span><ul class="toc-item"><li><span><a href="#Pandas-has-a-handy-function-to-generate-scatterplots:-https://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.DataFrame.plot.scatter.html" data-toc-modified-id="Pandas-has-a-handy-function-to-generate-scatterplots:-https://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.DataFrame.plot.scatter.html-1.2.1">Pandas has a handy function to generate scatterplots: <a href="https://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.DataFrame.plot.scatter.html" target="_blank">https://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.DataFrame.plot.scatter.html</a></a></span></li></ul></li></ul></li></ul></div>

Sales
Instructions / Notes:
Read these carefully

Read and execute each cell in order, without skipping forward
You may create new Jupyter notebook cells to use for e.g. testing, debugging, exploring, etc.- this is encouraged in fact!- just make sure that your final answer dataframes and answers use the set variables outlined below
Have fun!
End of explanation
"""


df1.describe()

df2.describe()

df3.describe()

df4.describe()

"""
Explanation: Each of the 4 dataframes loaded above represents a company's average sales over time. Check the descriptive statistics below.
End of explanation
"""


least_rep_dataset_exists = 'Yes'

"""
Explanation: Can you identify a dataset that is least likely to represent a company's sales over time? Set the following variable to 'Yes' or 'No'.
End of explanation
"""


least_rep_dataset = 4

"""
Explanation: If you answered 'Yes' which dataset is least likely to represent a company's sales over time? 
Set the following variable to 1, 2, 3, or 4.
End of explanation
"""


df1.head()

# Show your revised analysis below
df_all = [df1, df2, df3, df4]

for df in df_all:
    df.plot.scatter('time', 'avg_sales')

least_rep_dataset_exists_clue = 'Yes'

least_rep_dataset_clue = 4

"""
Explanation: Clue
Pandas has a handy function to generate scatterplots: https://pandas.pydata.org/pandas-docs/version/0.21/generated/pandas.DataFrame.plot.scatter.html
If this clue changes your answer, try again below. Otherwise, if you are confident in your answer above, leave the following untouched.
End of explanation
"""


