fips.base.Structure2D#

class fips.base.Structure2D(data, name=None, index=None, columns=None, dtype=None, copy=None, sparse=False)[source]#

Bases: Structure

Base class for 2D structures (Matrix).

Parameters:
  • data (np.ndarray) – 2D data.

  • name (str, optional) – Name for the Structure.

  • index (pd.Index) – Index for the rows of the DataFrame.

  • columns (pd.Index, optional) – Index for the columns of the DataFrame. If None, uses the same as index.

  • dtype (data type, optional) – Data type to force.

  • copy (bool, optional) – Whether to copy the data.

  • sparse (bool, default False) – If True, store the data in pandas sparse format (fill_value=0.0). The caller is responsible for zeroing out near-zero values before setting sparse=True (e.g. via a threshold in the builder).

Attributes

columns

Return the columns of the underlying DataFrame.

data

The underlying data, which must be numeric and non-NaN.

is_sparse

True if the internal DataFrame uses pandas sparse storage.

name

Name of the structure, used for error messages and block naming.

values

Return values as numpy array or sparse matrix.

Methods

to_dense()

Return a copy with dense internal storage.

to_frame()

Get the underlying DataFrame data.

to_sparse([threshold])

Return a copy with sparse internal storage.

Inherited

From Structure: copy, index, reindex, round_index, shape, to_numpy, xs

From Pickleable: from_file, to_file