def _convert_to_array(X):
        """Convert the input data to an array if necessary."""
        if isinstance(X, csr_matrix):
            return X.A
        elif isinstance(X, np.ndarray):
            return X
        else:
            raise ValueError('Unexpected type for X: {}.'
                             .format(type(X).__name__))
Convert the input data to an array if necessary.
pyts/multivariate/transformation/multivariate.py