Created
October 26, 2016 21:11
-
-
Save bsmedberg/1663175a0f4a07288a036375c14e279b to your computer and use it in GitHub Desktop.
flash-installed-and-versions
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
# coding: utf-8 | |
# In[1]: | |
get_ipython().magic(u'pylab inline') | |
# In[2]: | |
sc.defaultParallelism | |
# In[19]: | |
q = "SELECT subsession_start_date, active_plugins FROM longitudinal" | |
# In[28]: | |
frame = sqlContext.sql(q) | |
# In[21]: | |
frame.schema | |
# In[22]: | |
frame.rdd.first() | |
# In[ ]: | |
import itertools | |
def map_flash_version(row): | |
for ssd, plugins in itertools.izip_longest(row.subsession_start_date, row.active_plugins or [], fillvalue=[]): | |
if not ssd.startswith('2016-10'): | |
continue | |
for plugin in plugins: | |
if plugin.name == 'Shockwave Flash': | |
return [plugin.version] | |
return [None] | |
return [] | |
values = frame.flatMap(map_flash_version).countByValue() | |
# In[ ]: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment