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
<html> | |
<head> | |
</head> | |
<body> | |
<p>Here is my image:</p> | |
<img id="img" src=""/> | |
<script type="text/javascript"> | |
document.getElementById('img').setAttribute( 'src', 'data:image/png;base64,PASTE_THE_BASE64_OUTPUT_HERE' ); | |
</script> | |
</body> |
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
var vals = {'one':1,'two':2}; | |
Object.keys(vals).forEach(function(i) {console.log('key:' + i + ', value:' + vals[i]);}); |
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
# https://www.reddit.com/r/datascience/comments/7ggdlz/what_do_you_hate_about_pandas/dqj6kaw/ | |
# some_df %>% | |
# mutate(new_column = do_something(old_column)) %>% | |
# group_by(new_column) %>% | |
# summarize(some_means = mean(other_column)) | |
df.assign(new_column = do_something(lambda x: x.old_column)) \ | |
.groupby('new_column') \ | |
.agg({'other_column':'mean'}) | |
.rename(columns={'mean':'some_means'}) |
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
# faster/vectorized replacement for getting monthly cohort | |
df['months_elapsed'] = (df['stats_date'].dt.month - df['first_date'].dt.month) + (12 * (df['stats_date'].dt.year - df['first_date'].dt.year)) | |
# for handy functions (pandas, seaborn, etc.) where you need to reshape the dataframe first | |
df.query('some_filter == "2020-01-01" & another_filter != "error"').pipe(lambda x: pd.crosstab(x['variation'],x['customers'])) |
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
from tkinter import HIDDEN, NORMAL, Tk, Canvas | |
def toggle_eyes(): | |
current_color = c.itemcget(eye_left,'fill') | |
new_color = c.body_color if current_color == 'white' else 'white' | |
current_state = c.itemcget(pupil_left,'state') | |
new_state = NORMAL if current_state == HIDDEN else HIDDEN | |
c.itemconfigure(pupil_left,state=new_state) | |
c.itemconfigure(pupil_right,state=new_state) | |
c.itemconfigure(eye_left,fill=new_color) |
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
# This file may be used to create an environment using: | |
# $ conda create --name <env> --file <this file> | |
# platform: osx-64 | |
@EXPLICIT | |
https://repo.anaconda.com/pkgs/main/osx-64/blas-1.0-mkl.conda | |
https://repo.anaconda.com/pkgs/main/osx-64/ca-certificates-2020.1.1-0.conda | |
https://repo.anaconda.com/pkgs/main/osx-64/intel-openmp-2019.4-233.conda | |
https://repo.anaconda.com/pkgs/main/osx-64/jpeg-9b-he5867d9_2.conda | |
https://repo.anaconda.com/pkgs/main/osx-64/libcxx-10.0.0-1.conda | |
https://repo.anaconda.com/pkgs/main/osx-64/libgfortran-3.0.1-h93005f0_2.conda |
OlderNewer