# Magics first (server issues)
%matplotlib inline 
# Do below if you want interactive matplotlib plot ()
# %matplotlib notebook 

# https://ipython.org/ipython-doc/dev/config/extensions/autoreload.html
%load_ext autoreload
%autoreload 2

# %install_ext http://raw.github.com/jrjohansson/version_information/master/version_information.py
%load_ext version_information
%version_information numpy, scipy, matplotlib, pandas

# Standard library
import os
import sys
sys.path.append("../src/")

# Third party imports
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

# Local imports
from simpleexample import example_func

# Customizations
sns.set() # matplotlib defaults

# Any tweaks that normally go in .matplotlibrc, etc., should explicitly go here
plt.rcParams['figure.figsize'] = (12, 12)

# Find the notebook the saved figures came from
fig_prefix = "../figures/2015-07-16-jw-"

example_func()

"""
Explanation: Example of how to set up your lab notebook
Analysis in this notebook

[Dead end] Does year predict production?
Does "hours worked" correlate with production?

Tip
Standard imports at the top
Imports should be grouped in the following order:

magics
Alphabetical order 
standard library imports
related third party imports
local application/library specific imports
End of explanation
"""


from IPython.display import FileLink

FileLink("../deliver/coal_data_cleanup.ipynb")

dframe = pd.read_csv("../data/coal_prod_cleaned.csv")

"""
Explanation: Importing cleaned data
See ../deliver/coal_data_cleanup.ipynb for how the raw data was cleaned.
End of explanation
"""


plt.scatter(dframe['Year'], dframe['Production_short_tons'])

"""
Explanation: [Dead end] Does year predict production?
End of explanation
"""


df2 = dframe.groupby('Mine_State').sum() 

sns.jointplot('Labor_Hours', 'Production_short_tons', data=df2, kind="reg", ) 
plt.xlabel("Labor Hours Worked")
plt.ylabel("Total Amount Produced") 
plt.tight_layout()
# plt.savefig(fig_prefix + "production-vs-hours-worked.png", dpi=350) 

%load_ext autoreload
%autoreload 2

import sys
sys.path.append("../src/")

from simpleexample import example_func
example_func()

example_func()

"""
Explanation: Does Hours worked correlate with output?
End of explanation
"""


