Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Distribution on the basis of skewness value:
- Skewness = 0: Then normally distributed.
- Skewness > 0: Then more weight in the left tail of the distribution; right skewed distribution
- Skewness < 0: Then more weight in the right tail of the distribution; left skewed distribution
- # skip the na values
- # over the column axis
- df.skew(axis = 1, skipna = True)
- # skip the na values
- # find skewness in each row
- df.skew(axis = 0, skipna = True)
- OR
- from scipy.stats import skew
- # Creating a dataset
- dataset = [88, 85, 82, 97, 67, 77, 74, 86,
- 81, 95, 77, 88, 85, 76, 81]
- # Calculate the skewness
- print(skew(dataset, axis=0, bias=False))
- #############################################
- Power Transform
- >>> import numpy as np
- >>> from sklearn.preprocessing import PowerTransformer
- >>> pt = PowerTransformer()
- >>> data = [[1, 2], [3, 2], [4, 5]]
- >>> print(pt.fit(data))
- PowerTransformer()
- >>> print(pt.lambdas_)
- [ 1.386... -3.100...]
- >>> print(pt.transform(data))
- [[-1.316... -0.707...]
- [ 0.209... -0.707...]
- [ 1.106... 1.414...]]
- ##############################################
- QuantileTransformer
- >>> import numpy as np
- >>> from sklearn.preprocessing import QuantileTransformer
- >>> rng = np.random.RandomState(0)
- >>> X = np.sort(rng.normal(loc=0.5, scale=0.25, size=(25, 1)), axis=0)
- >>> qt = QuantileTransformer(n_quantiles=10, random_state=0)
- >>> qt.fit_transform(X)
- array([...])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement