<jupyter_start><jupyter_text>Data SetupIn this notebook, we demonstrate how to:- setup time series data for this module- visualize the dataThe data in this example is taken from the GEFCom2014 forecasting competition1. It consists of 3 years of hourly electricity load and temperature values between 2012 and 2014. 1<NAME>, <NAME>, <NAME>, <NAME>, <NAME> and <NAME>, "Probabilistic energy forecasting: Global Energy Forecasting Competition 2014 and beyond", International Journal of Forecasting, vol.32, no.3, pp 896-913, July-September, 2016.<jupyter_code>import os
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd<jupyter_output><empty_output><jupyter_text>Load the data from csv into a Pandas dataframe<jupyter_code>data_dir = 'energy.csv'
energy = pd.read_csv(data_dir)
energy.head()<jupyter_output><empty_output><jupyter_text>Plot all available load data (January 2012 to Dec 2014)<jupyter_code>energy.plot(y='load', subplots=True, figsize=(15, 8), fontsize=12)
plt.xlabel('timestamp', fontsize=12)
plt.ylabel('load', fontsize=12)
plt.show()
print(energy["timestamp"].dtype)
energy["timestamp"] = pd.to_datetime(energy["timestamp"])
print(energy["timestamp"].dtype)
print(energy["timestamp"])<jupyter_output>0       2012-01-01 00:00:00
1       2012-01-01 01:00:00
2       2012-01-01 02:00:00
3       2012-01-01 03:00:00
4       2012-01-01 04:00:00
                ...        
26299   2014-12-31 19:00:00
26300   2014-12-31 20:00:00
26301   2014-12-31 21:00:00
26302   2014-12-31 22:00:00
26303   2014-12-31 23:00:00
Name: timestamp, Length: 26304, dtype: datetime64[ns]<jupyter_text>Plot first week of July 2014<jupyter_code>energy[20000:20100].plot(y='load', subplots=True, figsize=(15, 8), fontsize=12)
plt.xlabel('timestamp', fontsize=12)
plt.ylabel('load', fontsize=12)
plt.show()<jupyter_output><empty_output><jupyter_text>Homework<jupyter_code>import pandas as pd
data = 'oil.csv'
oil = pd.read_csv(data)
oil = oil.dropna()
oil.head()
oil.plot(y='dcoilwtico', subplots=True, figsize=(15, 8), fontsize=12)
plt.xlabel('timestamp', fontsize=12)
plt.ylabel('oil', fontsize=12)
plt.show()
oil[0:100].plot(y='dcoilwtico', subplots=True, figsize=(15, 8), fontsize=12)
plt.xlabel('timestamp', fontsize=12)
plt.ylabel('oil', fontsize=12)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14031277150304083, 'fraction_numerical': 0.11772371850564727, 'mean_word_length': 6.042813455657492, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '547598', 'license': 'MIT', 'n_tokens_mistral': 1030, 'n_tokens_neox': 818, 'n_words': 197, 'path': '7-TimeSeries/1-Introduction/working/data/notebook.ipynb', 'repo_name': 'turhancan97/ML-For-Beginners', 'size': '2343'}