# renom.utility.preprocess.interpolation package ¶

class ``` Interpolation ``` ( x , mode , axis=0 , missing=(inf , nan , ' ') , dtype=None )

Interpolate missing values in input numpy array.

``` interpolate ``` ( x , mode , axis=0 , missing=(inf , nan , ' ') , dtype=None , constant=None )

* missing value*に入力された記号を欠損値とみなし、特定の方法で補間する。

 パラメータ: x ( ndarray ) – 補間する行列 mode ( {"linear" , "constant" , "spline"} ) – 補間方法 axis ( int ) – 補間する軸の方向 missing ( str , number or its sequence ) – 欠損値とみなす記号 dtype ( dtype ) – 返す行列のデータタイプ constant ( str or int ) – 欠損値に入れる値(mode=”constant”のとき) 補間された行列 ndarray
```>>> import numpy as np
>>> from renom.utility.preprocess import interpolate
>>> x = np.array([[2.0, 3.0, 5.0],[3.0, np.nan, 8.0],[6.0, np.nan, 9.0],[7.0, 9.0, np.nan],[8.0, 10.0, 10.0]])
>>> x
array([[  2.,   3.,   5.],
[  3.,  nan,   8.],
[  6.,  nan,   9.],
[  7.,   9.,  nan],
[  8.,  10.,  10.]])
>>> interpolate(x, mode="linear")
array([[  2. ,   3. ,   5. ],
[  3. ,   5. ,   8. ],
[  6. ,   7. ,   9. ],
[  7. ,   9. ,   9.5],
[  8. ,  10. ,  10. ]])
>>> interpolate(x, mode="constant")
array([[  2.,   3.,   5.],
[  3.,   3.,   8.],
[  6.,   9.,   9.],
[  7.,   9.,   9.],
[  8.,  10.,  10.]])
>>> interpolate(x, mode="spline")
array([[  2.        ,   3.        ,   5.        ],
[  3.        ,   5.33333333,   8.        ],
[  6.        ,   7.41666667,   9.        ],
[  7.        ,   9.        ,   9.5       ],
[  8.        ,  10.        ,  10.        ]])
```