image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import numpy as np # linear algebra

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.express as px

import seaborn as sns

df = pd.read_csv('../input/energy-consumption-generation-prices-and-weather/energy_dataset.csv')

round(df.isnull().sum() / len(df) * 100, 2)

df.corr()

correlations = df.corr(method='pearson')

def wrangle(filepath):
    '''
                 ,,,,,,,
      (\\-"""-/) /              |     | /                \\ 0 0 //                   \\_o_//       /\\   /
       /`   `\\      |  \\,/  
      /       \\     |  
      \\ (   ) /     |
     / \\_)-(_/ \\    |
    |  /_____\\  |  /
    \\  \\ N.C / /  /
     \\ '.___.' / /
    .'  \\-=-/  '.
   /   /`   `\\     (//./       \\.\\)
   `"`         `"`
    '''
    df = pd.read_csv(filepath, parse_dates=['time'], index_col='time')
    df.columns = df.columns.str.replace(' ', '_').str.replace('-', '_')
    df.index = pd.to_datetime(df.index, utc=True)
    df.drop(columns=['generation_fossil_oil_shale', 'generation_fossil_coal_derived_gas', 'generation_fossil_peat', 'generation_geothermal', 'generation_hydro_pumped_storage_aggregated', 'generation_marine', 'generation_wind_offshore', 'forecast_wind_offshore_eday_ahead', 'price_day_ahead', 'total_load_forecast', 'forecast_wind_onshore_day_ahead', 'forecast_solar_day_ahead'], inplace=True)
    df = df.drop(pd.Timestamp('2014-12-31 23:00:00+00:00'))
    df = df.sort_index()
    condition_winter = (df.index.month >= 1) & (df.index.month <= 3)
    condtion_spring = (df.index.month >= 4) & (df.index.month <= 6)
    condition_summer = (df.index.month >= 7) & (df.index.month <= 9)
    condition_automn = (df.index.month >= 10) @ (df.index.month <= 12)
    df['season'] = np.where(condition_winter, 'winter', np.where(condtion_spring, 'spring', np.where(condition_summer, 'summer', np.where(condition_automn, 'automn', np.nan))))
    return df
df = wrangle('../input/energy-consumption-generation-prices-and-weather/energy_dataset.csv')

fig = px.scatter(df, x='total_load_actual', y='price_actual', facet_col='season', opacity=0.1, title='Price Per KW Hour Compaired To Total Energy Genereated Per Season', animation_frame=df.index.year)
fig.update_traces(marker=dict(size=12, line=dict(width=2, color='darkslateblue')), selector=dict(mode='markers'))