> ## Documentation Index
> Fetch the complete documentation index at: https://kb.talostrading.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DataCollection

```python theme={null}
class coinmetrics._data_collection.DataCollection(
    data_retrieval_function,
    endpoint,
    url_params,
    csv_export_supported=True,
    client=None,
    paginated=True,
    **kwargs,
)
```

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Lazy wrapper around a Coin Metrics REST endpoint response.

Every REST method on [`CoinMetricsClient`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/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()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_dataframe#coinmetrics._data_collection.DataCollection.to_dataframe) -- materialize into a pandas or polars dataframe.
* [`to_list()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_list#coinmetrics._data_collection.DataCollection.to_list) -- materialize into `List[Dict[str, Any]]`.
* [`export_to_csv()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_csv#coinmetrics._data_collection.DataCollection.export_to_csv) -- stream the response into a CSV file or buffer.
* [`export_to_json()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_json#coinmetrics._data_collection.DataCollection.export_to_json) -- stream the response into a JSON file or buffer.
* [`export_to_parquet()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_parquet#coinmetrics._data_collection.DataCollection.export_to_parquet) -- stream the response into a Parquet file.
* [`parallel()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/parallel#coinmetrics._data_collection.DataCollection.parallel) -- return a [`ParallelDataCollection`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/parallel-data-collection) that splits the request across worker threads. The result can be chained with [`to_dataframe()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_dataframe#coinmetrics._data_collection.DataCollection.to_dataframe), [`to_list()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_list#coinmetrics._data_collection.DataCollection.to_list), [`export_to_csv_files()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/parallel-data-collection/export_to_csv_files#coinmetrics._data_collection.ParallelDataCollection.export_to_csv_files), [`export_to_json_files()`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/parallel-data-collection/export_to_json_files#coinmetrics._data_collection.ParallelDataCollection.export_to_json_files), and so on.
* **Parameters:**
  * **data\_retrieval\_function** (*DataRetrievalFuncType*)
  * **endpoint** ([*str*](https://docs.python.org/3/library/stdtypes.html#str))
  * **url\_params** (*Dict* *\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str) *,* *UrlParamTypes* *]*)
  * **csv\_export\_supported** ([*bool*](https://docs.python.org/3/library/functions.html#bool))
  * **client** (*Optional* *\[*[*CoinMetricsClient*](https://kb.talostrading.com/coinmetrics/python-api-client/reference/coinmetricsclient) *]*)
  * **paginated** ([*bool*](https://docs.python.org/3/library/functions.html#bool))
  * **kwargs** (*Any*)

### Methods

* [`DataCollection.get_schema_field_names`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/get_schema_field_names)
* [`DataCollection.first_page`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/first_page)
* [`DataCollection.to_list`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_list)
* [`DataCollection.export_to_csv`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_csv)
* [`DataCollection.export_to_json`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_json)
* [`DataCollection.export_to_parquet`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/export_to_parquet)
* [`DataCollection.to_dataframe`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_dataframe)
* [`DataCollection.to_lazyframe`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/to_lazyframe)
* [`DataCollection.parallel`](https://kb.talostrading.com/coinmetrics/python-api-client/reference/data-collection/parallel)
