DataCollection
Last updated
Was this helpful?
class coinmetrics._data_collection.DataCollection(
data_retrieval_function,
endpoint,
url_params,
csv_export_supported=True,
client=None,
paginated=True,
**kwargs,
)Bases: object
Lazy wrapper around a Coin Metrics REST endpoint response.
Every REST method on CoinMetricsClient returns a DataCollection. It iterates over rows on demand (with transparent paging) and exposes helpers for converting the response into common Python data structures:
to_dataframe() -- materialize into a pandas or polars dataframe.
to_list() -- materialize into List[Dict[str, Any]].
export_to_csv() -- stream the response into a CSV file or buffer.
export_to_json() -- stream the response into a JSON file or buffer.
export_to_parquet() -- stream the response into a Parquet file.
parallel() -- return a ParallelDataCollection that splits the request across worker threads. The result can be chained with to_dataframe(), to_list(), export_to_csv_files(), export_to_json_files(), and so on.
Parameters:
data_retrieval_function (DataRetrievalFuncType)
endpoint (str)
url_params (Dict [str , UrlParamTypes ])
csv_export_supported (bool)
client (Optional [CoinMetricsClient ])
paginated (bool)
kwargs (Any)
Last updated
Was this helpful?
Was this helpful?