<a id="skfolio-containers-field2d"></a>

# skfolio.containers.Field2D

<a id="skfolio.containers.Field2D"></a>

### *class* skfolio.containers.Field2D(values, \*, inactive_policy=MISSING)

Numeric 2D field with axes (observations, assets).

* **Parameters:**
  **values** *ndarray of shape (n_observations, n_assets)*
  : Numeric field values. Object dtype is rejected. Use `FieldCategorical` for
    categorical data.
* **Attributes:**
  [`dtype`](#skfolio.containers.Field2D.dtype)
  : Dtype of the underlying values.

  **inactive_policy**

  [`is_3d`](#skfolio.containers.Field2D.is_3d)
  : Whether or not the field is a 3D field.

  [`is_categorical`](#skfolio.containers.Field2D.is_categorical)
  : Whether or not the field is a categorical field.

  [`missing_mask`](#skfolio.containers.Field2D.missing_mask)
  : Return a boolean mask indicating missing entries.

  [`n_assets`](#skfolio.containers.Field2D.n_assets)
  : Number of assets.

  [`n_observations`](#skfolio.containers.Field2D.n_observations)
  : Number of observations.

  [`ndim`](#skfolio.containers.Field2D.ndim)
  : Number of dimensions of the underlying values.

  [`shape`](#skfolio.containers.Field2D.shape)
  : Shape of the underlying values.

  **values**

### Methods

| [`copy`](#skfolio.containers.Field2D.copy)(\*[, deep])    | Return a copy of the field.                              |
|----------------------------------------------------------------------|----------------------------------------------------------|
| [`with_values`](#skfolio.containers.Field2D.with_values)(values) | Return a field of the same type with replacement values. |

<a id="skfolio.containers.Field2D.copy"></a>

#### copy(\*, deep=False)

Return a copy of the field.

* **Parameters:**
  **deep** *bool, default=False*
  : If `True`, copy NumPy arrays stored by the field. If `False`, reuse the same
    array objects.
* **Returns:**
  **field** *BaseField*
  : Field instance of the same concrete class.

<a id="skfolio.containers.Field2D.dtype"></a>

#### *property* dtype

Dtype of the underlying values.

<a id="skfolio.containers.Field2D.is_3d"></a>

#### *property* is_3d

Whether or not the field is a 3D field.

<a id="skfolio.containers.Field2D.is_categorical"></a>

#### *property* is_categorical

Whether or not the field is a categorical field.

<a id="skfolio.containers.Field2D.missing_mask"></a>

#### *property* missing_mask

Return a boolean mask indicating missing entries.

* **Returns:**
  **mask** *ndarray of bool*
  : Boolean array with the same shape as `values`. Entries are `True`
    where `values` is NaN for floating-point fields and `False` elsewhere.
    Non-floating fields without a missing-value convention return an all-`False`
    mask; subclasses override this method when they define their own convention.

<a id="skfolio.containers.Field2D.n_assets"></a>

#### *property* n_assets

Number of assets.

<a id="skfolio.containers.Field2D.n_observations"></a>

#### *property* n_observations

Number of observations.

<a id="skfolio.containers.Field2D.ndim"></a>

#### *property* ndim

Number of dimensions of the underlying values.

<a id="skfolio.containers.Field2D.shape"></a>

#### *property* shape

Shape of the underlying values.

<a id="skfolio.containers.Field2D.with_values"></a>

#### with_values(values)

Return a field of the same type with replacement values.

Metadata arrays are reused. The replacement values are validated by the
concrete field class constructor.

* **Parameters:**
  **values** *array-like*
  : Replacement field values.
* **Returns:**
  **field** *BaseField*
  : Field instance of the same concrete class.

