This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from typing import Optional | |
def clean_onshore_s( | |
s_onshore: pd.Series, | |
delta_theshold_quantile: float = 0.96 | |
) -> pd.Series: | |
s_onshore_diff = s_onshore.diff() | |
delta_theshold_abs_value = s_onshore_diff.abs().quantile(delta_theshold_quantile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imports | |
import os | |
import dotenv | |
import pandas as pd | |
import ElexonDataPortal.API as edp_API | |
# Helper Functions | |
def create_BMRS_wrapper(API_key=None, env_fp='.env'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def dt_rng_to_SPs(start_date:datetime, end_date:datetime, freq='30T', tz='Europe/London'): | |
dt_rng = pd.date_range(start_date, end_date, freq=freq, tz=tz) | |
dt_strs = dt_rng.strftime('%Y-%m-%d') | |
dt_SP_counts = pd.Series(dt_strs).groupby(dt_strs).count() | |
SPs = [] | |
for num_SPs in dt_SP_counts.values: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from collections.abc import Iterable | |
from sklearn import linear_model | |
class AxTransformer: | |
def __init__(self, datetime_vals=False): | |
self.datetime_vals = datetime_vals | |
self.lr = linear_model.LinearRegression() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import requests | |
def isitdown(domain, return_bool=True): | |
""" | |
Uses the website 'isitdownrightnow.com' to check | |
whether the domain provided is down or not. | |
Parameters |