econml/utilities.py
def todense(X):
    """
    Convert an array to a dense numpy array.

    If the input is already a numpy array, this may create a new copy.
    """
    if scipy.sparse.issparse(X):
        return X.toarray()
    elif isinstance(X, sp.SparseArray):
        return X.todense()
    else:
        # TODO: any way to avoid creating a copy if the array was already dense?
        #       the call is necessary if the input was something like a list, though
        return np.array(X)

    Convert an array to a dense numpy array.

    If the input is already a numpy array, this may create a new copy.
    
Convert an array to a dense numpy array.
If the input is already a numpy array, this may create a new copy.
Convert an array to a dense numpy array . If the input is already a numpy array this may create a new copy .
def todense(X):
    if scipy.sparse.issparse(X):
        return X.toarray()
    elif isinstance(X, sp.SparseArray):
        return X.todense()
    else:
        return np.array(X)
def todense ( X ) : if scipy . sparse . issparse ( X ) : return X . toarray ( ) elif isinstance ( X , sp . SparseArray ) : return X . todense ( ) else : return np . array ( X )
Convert an array to a dense numpy array.
Convert an array to a dense numpy array .
"""
    Convert an array to a dense numpy array.

    If the input is already a numpy array, this may create a new copy.
    """ # TODO: any way to avoid creating a copy if the array was already dense? #       the call is necessary if the input was something like a list, though
X