Skip to content

Instantly share code, notes, and snippets.

View khurchla's full-sized avatar
📊
studio|classroom|office

Kathryn Hurchla khurchla

📊
studio|classroom|office
View GitHub Profile
@khurchla
khurchla / numpy_unique.py
Created July 15, 2022 13:46
factorize string objects with python numpy courtesy of Matt
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
@khurchla
khurchla / whylogs_profile_views.py
Last active June 7, 2022 02:33
whylogs v1 profile visualizer examples
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()
# 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)
cond_reference = (wine['alcohol']<=11)
wine_reference = wine.loc[cond_reference]
cond_target = (wine['alcohol']>11)
wine_target = wine.loc[cond_target]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@khurchla
khurchla / profile_visualizer_initialize
Created June 7, 2022 01:55
initialize whylogs v1 profile visualizer
from whylogs.viz import NotebookProfileVisualizer
visualization = NotebookProfileVisualizer()
visualization.set_profiles(target_profile_view=prof_view, reference_profile_view=prof_view_ref)
@khurchla
khurchla / Notebook_Profile_Visualizer_drift_analysis-wine_quality_drift_report.ipynb
Last active June 7, 2022 01:47
demo example of whylogs v1 profile visualizer summary drift report to compare two data profile views
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@khurchla
khurchla / whylogs_profile_visualizer_install_dependencies.ipynb
Last active June 7, 2022 01:33
whylogs v1 profile visualizer install dependencies in a Jupyter Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@khurchla
khurchla / profile_visualizer_visualization_write.py
Last active June 7, 2022 02:47
download whylogs profile visualizer charts or report in HTML format
# write the Difference Distribution bar chart of the citric acid feature to file
# in an output subdirectory
import os
os.getcwd()
visualization.write(
rendered_html=visualization.difference_distribution_chart(
feature_name="citric acid", profile="target"
),
html_file_name=os.getcwd() + "/output/diff_dist_citric_acid_example",
)
@khurchla
khurchla / radial_charts.py
Created May 27, 2022 23:05
Plotly Dash Python Radial Chart manual subplots
values = {'Timestamp':['5/20/2022 19:44:43', '5/20/2022 20:14:36',
'5/20/2022 20:14:38', '5/20/2022 20:14:39',
'5/20/2022 19:44:43', '5/20/2022 20:14:46',
'5/20/2022 20:14:47', '5/20/2022 19:44:49',
'5/20/2022 20:14:51', '5/20/2022 20:14:53',
'5/20/2022 20:14:56'],
'Build':[6, 4, 6, 6, 3, 6, 1, 4, 5, 6, 2],
'Story':[6, 3, 6, 5, 6, 3, 1, 3, 3, 3, 1],
'Design':[6, 6, 5, 4, 4, 4, 2, 6, 1, 2, 2],
'Systems':[6, 2, 6, 1, 1, 5, 6, 1, 2, 3, 2],