(X, feature_range=(0, 1))
return x_scaled
Transforms features by scaling each feature to a given range.

    This estimator scales and translates each feature individually such
    that it is in the given range on the training set, i.e. between
    zero and one.

    The transformation is given by::

        X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))
        X_scaled = X_std * (max - min) + min

    where min, max = feature_range.

    Parameters
    ----------
    X : array-like, shape (n_samples, n_features)
        The data matrix with [n_samples, n_features].

    feature_range : tuple (min, max), default=(0, 1)
        Desired range of transformed data.
    
    Returns
    -------
    x_scaled : array-like, shape (n_samples, n_features)
        The data after the transformation.
Transforms features by scaling each feature to a given range.
Transforms features by scaling each feature to a given range .
def minmax_scale(X, feature_range=(0, 1)):
    """Transforms features by scaling each feature to a given range.

    This estimator scales and translates each feature individually such
    that it is in the given range on the training set, i.e. between
    zero and one.

    The transformation is given by::

        X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))
        X_scaled = X_std * (max - min) + min

    where min, max = feature_range.

    Parameters
    ----------
    X : array-like, shape (n_samples, n_features)
        The data matrix with [n_samples, n_features].

    feature_range : tuple (min, max), default=(0, 1)
        Desired range of transformed data.
    
    Returns
    -------
    x_scaled : array-like, shape (n_samples, n_features)
        The data after the transformation.
        
    """

    if feature_range[0] >= feature_range[1]:
            raise ValueError("Minimum of desired feature range must be smaller"
                             " than maximum. Got %s." % str(feature_range))
    
    if sparse.issparse(X):
            raise TypeError("MinMaxScaler does no support sparse input. "
                            "You may consider to use MaxAbsScaler instead.")
    if not isinstance(X, np.ndarray):
        X = np.asarray(X)
        
    data_min = np.nanmin(X, axis=0)
    data_max = np.nanmax(X, axis=0)
    data_dis = data_max - data_min
    data_dis = _handle_zeros_in_scale(data_dis)

    x_std = (X - data_min) / data_dis
    x_scaled = x_std * (feature_range[1] - feature_range[0]) + feature_range[0]
    return x_scaled
def minmax_scale ( X , feature_range = ( 0 , 1 ) ) : if feature_range [ 0 ] >= feature_range [ 1 ] : raise ValueError ( "Minimum of desired feature range must be smaller" " than maximum. Got %s." % str ( feature_range ) ) if sparse . issparse ( X ) : raise TypeError ( "MinMaxScaler does no support sparse input. " "You may consider to use MaxAbsScaler instead." ) if not isinstance ( X , np . ndarray ) : X = np . asarray ( X ) data_min = np . nanmin ( X , axis = 0 ) data_max = np . nanmax ( X , axis = 0 ) data_dis = data_max - data_min data_dis = _handle_zeros_in_scale ( data_dis ) x_std = ( X - data_min ) / data_dis x_scaled = x_std * ( feature_range [ 1 ] - feature_range [ 0 ] ) + feature_range [ 0 ] return x_scaled