Utils
==========================

.. py:module:: gridstatus.utils


Module Contents
---------------



Functions
~~~~~~~~~

.. autoapisummary::
   :nosignatures:

   gridstatus.utils.convert_bool_to_emoji
   gridstatus.utils.download_csvs_from_zip_url
   gridstatus.utils.filter_lmp_locations
   gridstatus.utils.format_interconnection_df
   gridstatus.utils.get_interconnection_queues
   gridstatus.utils.get_iso
   gridstatus.utils.get_response_blob
   gridstatus.utils.get_zip_file
   gridstatus.utils.get_zip_folder
   gridstatus.utils.is_dst_end
   gridstatus.utils.is_today
   gridstatus.utils.is_within_last_days
   gridstatus.utils.is_yesterday
   gridstatus.utils.list_isos
   gridstatus.utils.load_folder
   gridstatus.utils.make_availability_df
   gridstatus.utils.make_availability_table
   gridstatus.utils.make_lmp_availability_df
   gridstatus.utils.make_lmp_availability_table
   gridstatus.utils.move_cols_to_front



Attributes Summary
~~~~~~~~~~~~~~~~~~~

.. autoapisummary::

   gridstatus.utils.all_isos
   gridstatus.utils.GREEN_CHECKMARK_HTML_ENTITY
   gridstatus.utils.LMP_METHOD_NAMES
   gridstatus.utils.RED_X_HTML_ENTITY


Contents
~~~~~~~~~~~~~~~~~~~
.. py:data:: all_isos
   :type:  list[gridstatus.base.ISOBase]

.. py:function:: convert_bool_to_emoji(value: bool) -> str

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


.. py:function:: 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)

.. py:function:: filter_lmp_locations(df: pandas.DataFrame, locations: list[str] | None = None, location_type: str | None = None) -> pandas.DataFrame

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

   :param df: DataFrame to filter
   :type df: pandas.DataFrame
   :param locations: "ALL" or list of locations to filter "Location" column by


.. py:function:: format_interconnection_df(queue: pandas.DataFrame, rename: dict[str, str], extra: list[str] | None = None, missing: list[str] | None = None) -> pandas.DataFrame

   Format interconnection queue data


.. py:function:: get_interconnection_queues() -> pandas.DataFrame

   Get interconnection queue data for all ISOs


.. py:function:: get_iso(iso_id: str) -> gridstatus.base.ISOBase

   Get an ISO by its id


.. py:function:: get_response_blob(resp: requests.Response) -> io.BytesIO

.. py:function:: get_zip_file(url: str, verbose: bool = False) -> zipfile.ZipFile

.. py:function:: get_zip_folder(url: str, verbose: bool = False, **kwargs) -> zipfile.ZipFile

.. py:data:: GREEN_CHECKMARK_HTML_ENTITY
   :type:  str
   :value: '&#x2705;'


.. py:function:: is_dst_end(date: pandas.Timestamp) -> bool

.. py:function:: is_today(date: str | pandas.Timestamp, tz: str) -> bool

.. py:function:: is_within_last_days(date: pandas.Timestamp, days: int, tz: str) -> bool

   Returns whether date is within N days


.. py:function:: is_yesterday(date: pandas.Timestamp, tz: str) -> bool

.. py:function:: list_isos() -> pandas.DataFrame

   List available ISOs


.. py:data:: LMP_METHOD_NAMES
   :type:  list[str]
   :value: ['get_lmp', 'get_spp']


.. py:function:: load_folder(path: str, time_zone: str | None = None, verbose: bool = True) -> pandas.DataFrame

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

   :param path: path to folder
   :type path: str
   :param time_zone: time zone to localize to timestamps.
                     By default returns as UTC
   :type time_zone: str
   :param verbose: print verbose output. Defaults to True.
   :type verbose: bool, optional

   :returns: A DataFrame of all files
   :rtype: pandas.DataFrame


.. py:function:: make_availability_df() -> dict[str, pandas.DataFrame]

.. py:function:: make_availability_table() -> str

.. py:function:: make_lmp_availability_df() -> pandas.DataFrame

.. py:function:: make_lmp_availability_table() -> str

.. py:function:: move_cols_to_front(df: pandas.DataFrame, cols_to_move: list[str]) -> pandas.DataFrame

   Move columns to front of DataFrame


.. py:data:: RED_X_HTML_ENTITY
   :type:  str
   :value: '&#10060;'


