This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cond_reference = (wine['alcohol']<=11) | |
wine_reference = wine.loc[cond_reference] | |
cond_target = (wine['alcohol']>11) | |
wine_target = wine.loc[cond_target] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add some missing values to a feature to see how they | |
ixs = wine.iloc[100:110].index | |
wine.loc[ixs,'citric acid'] = None | |
bins = (2, 6.5, 8) | |
group_names = ['bad', 'good'] | |
wine_reference['quality'] = pd.cut(wine_reference['quality'], bins = bins, labels = group_names) | |
wine_target['quality'] = pd.cut(wine_target['quality'], bins = bins, labels = group_names) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import whylogs as why | |
result = why.log(pandas=wine_target) | |
prof_view = result.view() | |
result_ref = why.log(pandas=wine_reference) | |
prof_view_ref = result_ref.view() | |
from whylogs.viz import NotebookProfileVisualizer | |
visualization = NotebookProfileVisualizer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unique = np.unique(df[['Rank 1','Rank 2','Rank 3','Rank 78','Rank 79','Rank 80']]) | |
factors = np.arange(len(unique)) | |
df[['Rank 1','Rank 2','Rank 3','Rank 78','Rank 79','Rank 80']] = df[['Rank 1','Rank 2','Rank 3','Rank 78','Rank 79','Rank 80']].replace(unique, factors) | |
df |
OlderNewer