<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nanrankdata(a, axis=-1, inplace=False):
 """ Rank data for arrays contaning NaN values. Parameters X : array_like Array of values. axis : int, optional Axis value. Defaults to `1`. inplace : bool, optional Defaults to `False`. Returns ------- array_like Ranked array. Examples -------- .. doctest:: [[1. 1. 1.] [2. 2. 2.] [3. 3. 3.] [4. 4. 4.] [5. 5. 5.]] """

    from scipy.stats import rankdata

    if hasattr(a, "dtype") and issubdtype(a.dtype, integer):
        raise ValueError("Integer type is not supported.")

    if isinstance(a, (tuple, list)):
        if inplace:
            raise ValueError("Can't use `inplace=True` for {}.".format(type(a)))
        a = asarray(a, float)

    orig_shape = a.shape
    if a.ndim == 1:
        a = a.reshape(orig_shape + (1,))

    if not inplace:
        a = a.copy()

    def rank1d(x):
        idx = ~isnan(x)
        x[idx] = rankdata(x[idx])
        return x

    a = a.swapaxes(1, axis)
    a = apply_along_axis(rank1d, 0, a)
    a = a.swapaxes(1, axis)

    return a.reshape(orig_shape)