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 econ_survey.py
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):
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))
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) %>%
View diamonds.py
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))
)
You can’t perform that action at this time.