# using_output_type

### *class* cuml.using_output_type(output_type)[[source]](https://github.com/NVIDIA/cuml/blob/93418baf5/python/cuml/cuml/internals/outputs.py#L127)

Configure the output type within a context.

* **Parameters:**
  **output_type**
  : Desired output type of results and attributes of the estimators.
    * `None`: No globally configured output type. This is the same as
      `'input'`, except in cases where an estimator explicitly sets
      an `output_type`.
    * `'input'`: returns arrays of the same type as the inputs to the
      function or method. Fitted attributes will be of the same array type
      as `X`.
    * `'cupy'`: returns `cupy` arrays.
    * `'numpy'`: returns `numpy` arrays.
    * `'cudf'`: returns `cudf.Series` for single dimensional results
      and `cudf.DataFrame` otherwise.
    * `'pandas'`: returns `pandas.Series` for single dimensional results
      and `pandas.DataFrame` otherwise.

#### SEE ALSO
[`cuml.set_global_output_type`](../cuml.set_global_output_type/index.html.md#cuml.set_global_output_type)

### Examples

```pycon
>>> import cuml
>>> import cupy as cp
>>> import cudf
```

Fit a model with a cupy array. By default the fitted attributes will be
cupy arrays.

```pycon
>>> X = cp.array([[1.0, 4.0, 4.0], [2.0, 2.0, 2.0], [5.0, 1.0, 1.0]])
>>> model = cuml.DBSCAN(eps=1.0, min_samples=1).fit(X)
>>> isinstance(model.labels_, cp.ndarray)
True
```

With a global output type set though, the fitted attributes will match
the configured output type.

```pycon
>>> with cuml.using_output_type("cudf"):
...     print(isinstance(model.labels_, cudf.Series))
True
```

<!-- !! processed by numpydoc !! -->
