Skip to content

Instantly share code, notes, and snippets.

@bsmedberg
Created October 26, 2016 21:11
Show Gist options
  • Save bsmedberg/1663175a0f4a07288a036375c14e279b to your computer and use it in GitHub Desktop.
Save bsmedberg/1663175a0f4a07288a036375c14e279b to your computer and use it in GitHub Desktop.
flash-installed-and-versions
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
# 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