Skip to content

Instantly share code, notes, and snippets.

@chutten
Last active April 1, 2016 19:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chutten/cd0d60e1419ff20e3cefe2d12a9c2c93 to your computer and use it in GitHub Desktop.
beta46_e10s_cohort
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
# ### Distribution of e10sCohort in Beta46
# In[1]:
import ujson as json
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import plotly.plotly as py
from plotly.graph_objs import *
from moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client, get_clients_history, get_records
get_ipython().magic(u'pylab inline')
# In[2]:
sc.defaultParallelism
# In[3]:
pings = get_pings(sc, app="Firefox", channel="beta", version="46.0", fraction=0.01)
# In[4]:
subset = get_pings_properties(pings, ["clientId",
"environment/settings/e10sEnabled",
"environment/settings/e10sCohort"])
# In[6]:
subset = get_one_ping_per_client(subset)
# In[7]:
cached = subset.cache()
# How many clients are we looking at?
# In[8]:
cached.count()
# In[14]:
cohorts_rdd = cached.filter(lambda p: p["environment/settings/e10sCohort"] is not None)
cohorts_count = cohorts_rdd.count()
cohorts = cohorts_rdd.map(lambda p: ((p["environment/settings/e10sCohort"], p["environment/settings/e10sEnabled"]), 1)).countByKey()
cohorts
# In[15]:
{k:"{:.2%}".format(float(v) / float(cohorts_count)) for (k,v) in cohorts.iteritems()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment