limix.qc.mean_impute

limix.qc.mean_impute(X, axis=-1, inplace=False)[source]

Impute NaN values.

It defaults to column-wise imputation.

Parameters
  • X (array_like) – Matrix to have its missing values imputed.

  • axis (int, optional) – Axis value. Defaults to -1.

  • inplace (bool, optional) – Defaults to False.

Returns

Imputed array.

Return type

ndarray

Examples

>>> from numpy.random import RandomState
>>> from numpy import nan, array_str
>>> from limix.qc import mean_impute
>>>
>>> random = RandomState(0)
>>> X = random.randn(5, 2)
>>> X[0, 0] = nan
>>>
>>> print(array_str(mean_impute(X), precision=4))
[[ 0.9233  0.4002]
 [ 0.9787  2.2409]
 [ 1.8676 -0.9773]
 [ 0.9501 -0.1514]
 [-0.1032  0.4106]]