Skip to content

Instantly share code, notes, and snippets.

Chris Said csaid

Block or report user

Report or block csaid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View diamonds.R
# 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) %>%
import pandas as pd
from ggplot import diamonds
# 1) How do I easily create multiple summaries of multiple columns?
.agg(??) # Equivalent of summarize(mean_x = mean(x), var_xy = var(xy))
View dplython
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))
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import cps
import seaborn as sns
# This is a quick hack that gets the job done :/
def repulsion(arr):
You can’t perform that action at this time.