Utils#

Module Contents#

Functions#

convert_bool_to_emoji(→ str)

If value is boolean, convert to Green Checkmark or Red X. Otherwise, leave be.

download_csvs_from_zip_url(url[, process_csv, ...])

filter_lmp_locations(→ pandas.DataFrame)

Filters DataFrame by locations, which can be a list, "ALL" or None

format_interconnection_df(→ pandas.DataFrame)

Format interconnection queue data

get_interconnection_queues(→ pandas.DataFrame)

Get interconnection queue data for all ISOs

get_iso(→ gridstatus.base.ISOBase)

Get an ISO by its id

get_response_blob(→ io.BytesIO)

get_zip_file(→ zipfile.ZipFile)

get_zip_folder(→ zipfile.ZipFile)

is_dst_end(→ bool)

is_today(→ bool)

is_within_last_days(→ bool)

Returns whether date is within N days

is_yesterday(→ bool)

list_isos(→ pandas.DataFrame)

List available ISOs

load_folder(→ pandas.DataFrame)

Load a single DataFrame for same schema csv files in a folder

make_availability_df(→ dict[str, pandas.DataFrame])

make_availability_table(→ str)

make_lmp_availability_df(→ pandas.DataFrame)

make_lmp_availability_table(→ str)

move_cols_to_front(→ pandas.DataFrame)

Move columns to front of DataFrame

Attributes Summary#

Contents#

gridstatus.utils.all_isos: list[gridstatus.base.ISOBase][source]#
gridstatus.utils.convert_bool_to_emoji(value: bool) str[source]#

If value is boolean, convert to Green Checkmark or Red X. Otherwise, leave be.

gridstatus.utils.download_csvs_from_zip_url(url: str, process_csv: Callable[[pandas.DataFrame, str], pandas.DataFrame] | None = None, verbose: bool = False, strip_whitespace_from_cols: bool = False)[source]#
gridstatus.utils.filter_lmp_locations(df: pandas.DataFrame, locations: list[str] | None = None, location_type: str | None = None) pandas.DataFrame[source]#

Filters DataFrame by locations, which can be a list, “ALL” or None

Parameters:
  • df (pandas.DataFrame) – DataFrame to filter

  • locations – “ALL” or list of locations to filter “Location” column by

gridstatus.utils.format_interconnection_df(queue: pandas.DataFrame, rename: dict[str, str], extra: list[str] | None = None, missing: list[str] | None = None) pandas.DataFrame[source]#

Format interconnection queue data

gridstatus.utils.get_interconnection_queues() pandas.DataFrame[source]#

Get interconnection queue data for all ISOs

gridstatus.utils.get_iso(iso_id: str) gridstatus.base.ISOBase[source]#

Get an ISO by its id

gridstatus.utils.get_response_blob(resp: requests.Response) io.BytesIO[source]#
gridstatus.utils.get_zip_file(url: str, verbose: bool = False) zipfile.ZipFile[source]#
gridstatus.utils.get_zip_folder(url: str, verbose: bool = False, **kwargs) zipfile.ZipFile[source]#
gridstatus.utils.GREEN_CHECKMARK_HTML_ENTITY: str = '✅'[source]#
gridstatus.utils.is_dst_end(date: pandas.Timestamp) bool[source]#
gridstatus.utils.is_today(date: str | pandas.Timestamp, tz: str) bool[source]#
gridstatus.utils.is_within_last_days(date: pandas.Timestamp, days: int, tz: str) bool[source]#

Returns whether date is within N days

gridstatus.utils.is_yesterday(date: pandas.Timestamp, tz: str) bool[source]#
gridstatus.utils.list_isos() pandas.DataFrame[source]#

List available ISOs

gridstatus.utils.LMP_METHOD_NAMES: list[str] = ['get_lmp', 'get_spp'][source]#
gridstatus.utils.load_folder(path: str, time_zone: str | None = None, verbose: bool = True) pandas.DataFrame[source]#

Load a single DataFrame for same schema csv files in a folder

Parameters:
  • path (str) – path to folder

  • time_zone (str) – time zone to localize to timestamps. By default returns as UTC

  • verbose (bool, optional) – print verbose output. Defaults to True.

Returns:

A DataFrame of all files

Return type:

pandas.DataFrame

gridstatus.utils.make_availability_df() dict[str, pandas.DataFrame][source]#
gridstatus.utils.make_availability_table() str[source]#
gridstatus.utils.make_lmp_availability_df() pandas.DataFrame[source]#
gridstatus.utils.make_lmp_availability_table() str[source]#
gridstatus.utils.move_cols_to_front(df: pandas.DataFrame, cols_to_move: list[str]) pandas.DataFrame[source]#

Move columns to front of DataFrame

gridstatus.utils.RED_X_HTML_ENTITY: str = '❌'[source]#