##
**Distribution of electricity load consumption: **

Histogram: distribution of density – for each power (kWatt) it’s number of occurrences – after split into 200 bins.

We extract features of datetime index object.
Quarter of the date: Jan-Mar = 1, Apr-Jun = 2, etc.

The enhanced with novel features dataframe is displayed. It is effective at time series load-forecasting. It may be used as additional sub-features affecting electric consumption.

##
**Winter Energy Consumption:**

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_234/757954271.py in <module>
1 _ = (df['electricity_consumption'].loc[ (df['electricity_consumption'].index >= '2016-12-01') &
2 (df['electricity_consumption'].index < '2017-01-01') ]
----> 3 .plot(figsize=(15, 5), title = 'December 2016'))
4 plt.show()
/usr/local/lib/python3.7/site-packages/pandas/plotting/_core.py in __call__(self, *args, **kwargs)
792 data.columns = label_name
793
--> 794 return plot_backend.plot(data, kind=kind, **kwargs)
795
796 def line(self, x=None, y=None, **kwargs):
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/__init__.py in plot(data, kind, **kwargs)
60 kwargs["ax"] = getattr(ax, "left_ax", ax)
61 plot_obj = PLOT_CLASSES[kind](data, **kwargs)
---> 62 plot_obj.generate()
63 plot_obj.draw()
64 return plot_obj.result
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/core.py in generate(self)
277 def generate(self):
278 self._args_adjust()
--> 279 self._compute_plot_data()
280 self._setup_subplots()
281 self._make_plot()
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/core.py in _compute_plot_data(self)
402 data = data._convert(datetime=True, timedelta=True)
403 numeric_data = data.select_dtypes(
--> 404 include=[np.number, "datetime", "datetimetz", "timedelta"]
405 )
406
/usr/local/lib/python3.7/site-packages/pandas/core/frame.py in select_dtypes(self, include, exclude)
3440 # the "union" of the logic of case 1 and case 2:
3441 # we get the included and excluded, and return their logical and
-> 3442 include_these = Series(not bool(include), index=self.columns)
3443 exclude_these = Series(not bool(exclude), index=self.columns)
3444
/usr/local/lib/python3.7/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
312 data = data.copy()
313 else:
--> 314 data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True)
315
316 data = SingleBlockManager(data, index, fastpath=True)
/usr/local/lib/python3.7/site-packages/pandas/core/internals/construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure)
710 value = maybe_cast_to_datetime(value, dtype)
711
--> 712 subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype)
713
714 else:
/usr/local/lib/python3.7/site-packages/pandas/core/dtypes/cast.py in construct_1d_arraylike_from_scalar(value, length, dtype)
1231 value = ensure_str(value)
1232
-> 1233 subarr = np.empty(length, dtype=dtype)
1234 subarr.fill(value)
1235
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type

##
**Summer Energy Consumption:**

# **Daily Trends**

Daily trends: We analyze herein the weather as function of daytime

A **pivot table** is a table of statistics that summarizes the data of a more extensive table (such as from a database, spreadsheet, or business intelligence program).

This summary might include sums, averages, or other statistics, which the pivot table groups together in a meaningful way.

The above graphs shows windspeed average over entire data (using mean) as function of hour within the day, for each day-of-week.** Average windspeed(hour) is a periodic function that is day dependent.** The left most and rightmost corners nearly coincide.
This pivot_table generates a whole set of functions unobservable before that appear continuous – i.e. meaningful.

The above graphs shows pressure average over entire data (using mean) as function of hour within the day, for each day-of-week.
This pivot_table generates a whole set of functions unobservable before that appear continuous – i.e. meaningful.
**Average pressure(hour) is a periodic function that is hardly day dependent.** The left most and rightmost corners nearly coincide.

The above graphs shows temperature average over entire data (using mean) as function of hour within the day, for each day-of-week. This pivot_table generates a whole set of functions unobservable before that appear continuous – i.e. meaningful. ** Average Temperature(hour) is a periodic function that is hardly day dependent.** The left most and rightmost corners nearly coincide.

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_642/2738447322.py in <module>
3 values = 'dewpnt',
4 aggfunc = 'mean').plot(figsize=(18,6),
----> 5 title = 'dew point - Daily Trends')
6 plt.ylabel('Dew Point (Celsius)')
7 plt.show()
/usr/local/lib/python3.7/site-packages/pandas/plotting/_core.py in __call__(self, *args, **kwargs)
792 data.columns = label_name
793
--> 794 return plot_backend.plot(data, kind=kind, **kwargs)
795
796 def line(self, x=None, y=None, **kwargs):
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/__init__.py in plot(data, kind, **kwargs)
60 kwargs["ax"] = getattr(ax, "left_ax", ax)
61 plot_obj = PLOT_CLASSES[kind](data, **kwargs)
---> 62 plot_obj.generate()
63 plot_obj.draw()
64 return plot_obj.result
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/core.py in generate(self)
277 def generate(self):
278 self._args_adjust()
--> 279 self._compute_plot_data()
280 self._setup_subplots()
281 self._make_plot()
/usr/local/lib/python3.7/site-packages/pandas/plotting/_matplotlib/core.py in _compute_plot_data(self)
402 data = data._convert(datetime=True, timedelta=True)
403 numeric_data = data.select_dtypes(
--> 404 include=[np.number, "datetime", "datetimetz", "timedelta"]
405 )
406
/usr/local/lib/python3.7/site-packages/pandas/core/frame.py in select_dtypes(self, include, exclude)
3440 # the "union" of the logic of case 1 and case 2:
3441 # we get the included and excluded, and return their logical and
-> 3442 include_these = Series(not bool(include), index=self.columns)
3443 exclude_these = Series(not bool(exclude), index=self.columns)
3444
/usr/local/lib/python3.7/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
312 data = data.copy()
313 else:
--> 314 data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True)
315
316 data = SingleBlockManager(data, index, fastpath=True)
/usr/local/lib/python3.7/site-packages/pandas/core/internals/construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure)
710 value = maybe_cast_to_datetime(value, dtype)
711
--> 712 subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype)
713
714 else:
/usr/local/lib/python3.7/site-packages/pandas/core/dtypes/cast.py in construct_1d_arraylike_from_scalar(value, length, dtype)
1231 value = ensure_str(value)
1232
-> 1233 subarr = np.empty(length, dtype=dtype)
1234 subarr.fill(value)
1235
TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type

The above graphs shows dew point (temperature taking pressure into consideration) average over entire data (using mean) as function of hour within the day, for each day-of-week. This pivot_table generates a whole set of functions unobservable before that appear continuous – i.e. meaningful. **Average dew_point(hour) is a periodic function that is day dependent.** The left most and rightmost corners nearly coincide.

A scatter plot (frequency of occurrence, distribution) shows power distribution over hour, not as average.

Electricity consumption is not a weather parameter, rather it is a function of weather and historic load profile (history electricity consumption). The above graphs shows electricity consumption average over entire data (using mean) as function of hour within the day, for each day-of-week. This pivot_table generates a whole set of functions unobservable before that appear continuous – i.e. meaningful. **Average electricity_consumption(hour) is a periodic function that is day dependent**. The left most and rightmost corners nearly coincide.

###
**Box Plot**:

In descriptive statistics, a ** box plot** or ** boxplot** is a method for graphically depicting groups of numerical data through their quartiles. Box plots may also have lines extending vertically from the boxes (whiskers) indicating variability outside the upper and lower quartiles.

**The relation between box plot and normal distribution is:**

From the above diagrams we study the **load-duration pattern**. That specific electricity consumer (cluster) what is it’s specific day behavior. This is also a pattern enabling **customer segmentation** through load-duration plot.

Heat map reflect cross-correlation matrix of linear adaptation between each two factors. We see for example that dewpoint is with strong correlation to energy consumption.