gseapy/plot.py
def zscore(data2d, axis=0):
    """Standardize the mean and variance of the data axis Parameters.

    :param data2d: DataFrame to normalize.
    :param axis: int, Which axis to normalize across. If 0, normalize across rows,
                  if 1, normalize across columns. If None, don't change data
                  
    :Returns: Normalized DataFrame. Normalized data with a mean of 0 and variance of 1
              across the specified axis.

    """
    if axis is None:
        # normalized to mean and std using entire matrix
        # z_scored = (data2d - data2d.values.mean()) / data2d.values.std(ddof=1)
        return data2d
    assert axis in [0,1]
    # if axis == 1:
    #     z_scored = data2d
    # else:
    #     z_scored = data2d.T

    # z_scored = (z_scored - z_scored.mean()) / z_scored.std(ddof=1)
    
    # if axis == 1:
    #     return z_scored
    # else:
    #     return z_scored.T
    z_scored = data2d.apply(lambda x: (x-x.mean())/x.std(ddof=1), 
                            axis=operator.xor(1, axis))
    return z_scored
def zscore(data2d, axis=0):
    """Standardize the mean and variance of the data axis Parameters.

    :param data2d: DataFrame to normalize.
    :param axis: int, Which axis to normalize across. If 0, normalize across rows,
                  if 1, normalize across columns. If None, don't change data
                  
    :Returns: Normalized DataFrame. Normalized data with a mean of 0 and variance of 1
              across the specified axis.

    """
    if axis is None:
        # normalized to mean and std using entire matrix
        # z_scored = (data2d - data2d.values.mean()) / data2d.values.std(ddof=1)
        return data2d
    assert axis in [0,1]
    # if axis == 1:
    #     z_scored = data2d
    # else:
    #     z_scored = data2d.T

    # z_scored = (z_scored - z_scored.mean()) / z_scored.std(ddof=1)
    
    # if axis == 1:
    #     return z_scored
    # else:
    #     return z_scored.T
    z_scored = data2d.apply(lambda x: (x-x.mean())/x.std(ddof=1), 
                            axis=operator.xor(1, axis))
    return z_scored
Standardize the mean and variance of the data axis Parameters.

    :param data2d: DataFrame to normalize.
    :param axis: int, Which axis to normalize across. If 0, normalize across rows,
                  if 1, normalize across columns. If None, don't change data
                  
    :Returns: Normalized DataFrame. Normalized data with a mean of 0 and variance of 1
              across the specified axis.