Instantly share code, notes, and snippets.

# Chris Said csaid

Last active February 17, 2022 00:38
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created January 7, 2022 02:54
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active January 1, 2022 18:46
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active February 9, 2020 17:12
20,000 shower samples that can be used to solve the shower problem described in https://chris-said.io/2020/02/08/the-shower-problem/. Direction (left of right) is sampled from Bernoulli trials. Tau is sampled from a two-parameter Weibull distribution, using scipy's weibull_min: weibull_min.rvs(1.5, loc=0, scale=50, size=20_000)
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
direction tau 1.0 44.17309441579963 1.0 39.13313136222197 1.0 2.229445925263579 1.0 45.51885740055968 1.0 32.46369490822559 0.0 34.32693114812909 1.0 29.851265008411353 1.0 22.108872716835183 0.0 39.32300084317585
Last active April 10, 2016 20:25
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 pandas as pd import matplotlib.pyplot as plt import numpy as np import cps import seaborn as sns sns.set_style('white') plt.ion() # This is a quick hack that gets the job done :/ def repulsion(arr):
Created March 30, 2016 19:09
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 dplython import * diamonds >> group_by(X.cut) >> summarize(mean_x = np.mean(X.x), var_y = np.var(X.y)) diamonds >> group_by(X.cut) >> mutate(mean_x = np.mean(X.x), var_y = np.var(X.y))
Created March 30, 2016 18:49
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
 # R # 1) Easily create multiple summaries of multiple column. diamonds %>% group_by(cut) %>% summarize(mean_x = mean(x), var_xy = var(x * y)) # 2) Easily put multiple summaries back into the original data frame diamonds %>% group_by(cut) %>%
Last active March 30, 2016 18:55
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 pandas as pd from ggplot import diamonds # 1) How do I easily create multiple summaries of multiple columns? ( diamonds .groupby('cut') .agg(??) # Equivalent of summarize(mean_x = mean(x), var_xy = var(xy)) )