nbiatoolkit.utils.conv_response_list

Classes

ReturnType

Generic enumeration.

Functions

conv_response_list(→ List[dict[Any, ...)

Function that takes in a list of dictionaries and returns either a list or a dataframe.

Module Contents

class nbiatoolkit.utils.conv_response_list.ReturnType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

LIST = 'list'
DATAFRAME = 'dataframe'
nbiatoolkit.utils.conv_response_list.conv_response_list(response_json: List[dict[Any, Any]], return_type: nbiatoolkit.utils.nbia_endpoints.ReturnType) List[dict[Any, Any]] | pandas.DataFrame[source]

Function that takes in a list of dictionaries and returns either a list or a dataframe.

Parameters:
  • response_json (List[dict[Any, Any]]) – A response from the API in the form of a list of dictionaries.

  • return_type (ReturnType) – The desired return type for the response.

Returns:

Either a list of dictionaries or a DataFrame.

Return type:

List[dict[Any, Any]] | pd.DataFrame