Queer European MD passionate about IT

Mission612Solutions.ipynb 14 KB

Project: Jupyter Notebook

Keyboard Shortcuts I

welcome_message = 'Hello, Jupyter!'
first_cell = True

if first_cell:
    print(welcome_message)
    
print('First cell')
Hello, Jupyter!
First cell
result = 1200 / 5
second_cell = True

if second_cell:
    print(result)
    
print('Second cell')
240.0
Second cell
print('A true third cell')
A true third cell

State

def welcome(a_string):
    print('Welcome to ' + a_string + '!')
    
dq = 'Dataquest'
jn = 'Jupyter Notebook'
py = 'Python'
welcome(dq)
welcome(jn)
welcome(py)
Welcome to Dataquest!
Welcome to Jupyter Notebook!
Welcome to Python!

Hidden State

%history -p
>>> welcome_message = 'Hello, Jupyter!'
... first_cell = True
... 
... if first_cell:
...     print(welcome_message)
...     
... print('First cell')
...
>>> result = 1200 / 5
... second_cell = True
... 
... if second_cell:
...     print(result)
...     
... print('Second cell')
...
>>> print('A true third cell')
>>> def welcome(a_string):
...     print('Welcome to ' + a_string + '!')
...     
... dq = 'Dataquest'
... jn = 'Jupyter Notebook'
... py = 'Python'
...
>>> welcome(dq)
... welcome(jn)
... welcome(py)
...
>>> %history -p
# Restart & Clear Output
'''
Note: To reproduce exactly the output in this notebook
as whole:

1. Run all the cells above.
2. Restart the program's state but keep the output
(click Restart Kernel).
3. Then, run only the cells below.


(You were not asked in this exercise to write a note like this.
The note above was written to give more details on how to reproduce
the behavior seen in this notebook.)
'''
"\nNote: To reproduce exactly the output in this notebook\nas whole:\n\n1. Run all the cells above.\n2. Restart the program's state but keep the output\n(click Restart Kernel).\n3. Then, run only the cells below.\n\n\n(You were not asked in this exercise to write a note like this.\nThe note above was written to give more details on how to reproduce\nthe behavior seen in this notebook.)\n"
%history -p
>>> welcome_message = 'Hello, Jupyter!'
... first_cell = True
... 
... if first_cell:
...     print(welcome_message)
...     
... print('First cell')
...
>>> result = 1200 / 5
... second_cell = True
... 
... if second_cell:
...     print(result)
...     
... print('Second cell')
...
>>> print('A true third cell')
>>> def welcome(a_string):
...     print('Welcome to ' + a_string + '!')
...     
... dq = 'Dataquest'
... jn = 'Jupyter Notebook'
... py = 'Python'
...
>>> welcome(dq)
... welcome(jn)
... welcome(py)
...
>>> %history -p
>>> # Restart & Clear Output
>>> '''
... Note: To reproduce exactly the output in this notebook
... as whole:
... 
... 1. Run all the cells above.
... 2. Restart the program's state but keep the output
... (click Restart Kernel).
... 3. Then, run only the cells below.
... 
... 
... (You were not asked in this exercise to write a note like this.
... The note above was written to give more details on how to reproduce
... the behavior seen in this notebook.)
... '''
...
>>> %history -p
def welcome(a_string):
    welcome_msg = 'Welcome to ' + a_string + '!'
    return welcome_msg

dq = 'Dataquest'
jn = 'Jupyter Notebook'
welcome(dq)
welcome(jn)
welcome(py)
'Welcome to Python!'
%history -p
>>> welcome_message = 'Hello, Jupyter!'
... first_cell = True
... 
... if first_cell:
...     print(welcome_message)
...     
... print('First cell')
...
>>> result = 1200 / 5
... second_cell = True
... 
... if second_cell:
...     print(result)
...     
... print('Second cell')
...
>>> print('A true third cell')
>>> def welcome(a_string):
...     print('Welcome to ' + a_string + '!')
...     
... dq = 'Dataquest'
... jn = 'Jupyter Notebook'
... py = 'Python'
...
>>> welcome(dq)
... welcome(jn)
... welcome(py)
...
>>> %history -p
>>> # Restart & Clear Output
>>> '''
... Note: To reproduce exactly the output in this notebook
... as whole:
... 
... 1. Run all the cells above.
... 2. Restart the program's state but keep the output
... (click Restart Kernel).
... 3. Then, run only the cells below.
... 
... 
... (You were not asked in this exercise to write a note like this.
... The note above was written to give more details on how to reproduce
... the behavior seen in this notebook.)
... '''
...
>>> %history -p
>>> def welcome(a_string):
...     welcome_msg = 'Welcome to ' + a_string + '!'
...     return welcome_msg
... 
... dq = 'Dataquest'
... jn = 'Jupyter Notebook'
...
>>> welcome(dq)
... welcome(jn)
... welcome(py)
...
>>> %history -p
welcome(dq)
welcome(jn)
welcome(py)
'Welcome to Python!'

Markdown Syntax

In the code cell below, we:

  • Open the AppleStore.csv file using the open() function, and assign the output to a variable named opened_file
  • Import the reader() function from the csv module
  • Read in the opened file using the reader() function, and assign the output to a variable named read_file
  • Transform the read-in file to a list of lists using list() and save it to a variable named apps_data
  • Display the header row and the first three rows of the data set.
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

apps_data[:4]
[['id',
  'track_name',
  'size_bytes',
  'currency',
  'price',
  'rating_count_tot',
  'rating_count_ver',
  'user_rating',
  'user_rating_ver',
  'ver',
  'cont_rating',
  'prime_genre',
  'sup_devices.num',
  'ipadSc_urls.num',
  'lang.num',
  'vpp_lic'],
 ['284882215',
  'Facebook',
  '389879808',
  'USD',
  '0.0',
  '2974676',
  '212',
  '3.5',
  '3.5',
  '95.0',
  '4+',
  'Social Networking',
  '37',
  '1',
  '29',
  '1'],
 ['389801252',
  'Instagram',
  '113954816',
  'USD',
  '0.0',
  '2161558',
  '1289',
  '4.5',
  '4.0',
  '10.23',
  '12+',
  'Photo & Video',
  '37',
  '0',
  '29',
  '1'],
 ['529479190',
  'Clash of Clans',
  '116476928',
  'USD',
  '0.0',
  '2130805',
  '579',
  '4.5',
  '4.5',
  '9.24.12',
  '9+',
  'Games',
  '38',
  '5',
  '18',
  '1']]

The data set above contains information about more than 7000 Apple iOS mobile apps. The data was collected from the iTunes Search API by data engineer Ramanathan Perumal. Documentation for the data set can be found at this page, where you'll also be able to download the data set.

This is a table explaining what each column in the data set describes:

Column name Description
"id" App ID
"track_name" App Name
"size_bytes" Size (in Bytes)
"currency" Currency Type
"price" Price amount
"rating_count_tot" User Rating counts (for all version)
"rating_count_ver" User Rating counts (for current version)
"user_rating" Average User Rating value (for all version)
"user_rating_ver" Average User Rating value (for current version)
"ver" Latest version code
"cont_rating" Content Rating
"prime_genre" Primary Genre
"sup_devices.num" Number of supporting devices
"ipadSc_urls.num" Number of screenshots showed for display
"lang.num" Number of supported languages
"vpp_lic" Vpp Device Based Licensing Enabled