In [11]:
import numpy as np
import pandas as pd
%matplotlib inline

In [22]:
import csv
daily_engagement = []
with open('daily_engagement.csv') as f:
    reader = csv.DictReader(f)
    for row in reader:
        daily_engagement.append(row)

daily_engagement[0]
for r in daily_engagement:
    r['account_key'] = r['acct']
    del r['acct']

In [23]:
daily_engagement[0]


Out[23]:
{'account_key': '0',
 'lessons_completed': '0.0',
 'num_courses_visited': '1.0',
 'projects_completed': '0.0',
 'total_minutes_visited': '11.6793745',
 'utc_date': '2015-01-09'}

In [25]:
import csv
enrollments = []
with open('enrollments.csv') as f:
    reader = csv.DictReader(f)
    for row in reader:
        enrollments.append(row)
enrollments[0]


Out[25]:
{'account_key': '448',
 'cancel_date': '2015-01-14',
 'days_to_cancel': '65',
 'is_canceled': 'True',
 'is_udacity': 'True',
 'join_date': '2014-11-10',
 'status': 'canceled'}

In [28]:
for enrollment in enrollments:
    student = enrollment['account_key']
    if student not in daily_engagement:
        print(enrollment)
        break;


{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-14', 'is_udacity': 'True', 'join_date': '2014-11-10', 'account_key': '448', 'days_to_cancel': '65'}

In [31]:
for enrollment in enrollments:
    student = enrollment['is_udacity']
    if student == 'True': 
        print(enrollment)


{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-14', 'is_udacity': 'True', 'join_date': '2014-11-10', 'account_key': '448', 'days_to_cancel': '65'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2014-11-10', 'is_udacity': 'True', 'join_date': '2014-11-05', 'account_key': '448', 'days_to_cancel': '5'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-27', 'is_udacity': 'True', 'join_date': '2015-01-27', 'account_key': '448', 'days_to_cancel': '0'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2014-11-10', 'is_udacity': 'True', 'join_date': '2014-11-10', 'account_key': '448', 'days_to_cancel': '0'}
{'is_canceled': 'False', 'status': 'current', 'cancel_date': '', 'is_udacity': 'True', 'join_date': '2015-03-10', 'account_key': '448', 'days_to_cancel': ''}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-27', 'is_udacity': 'True', 'join_date': '2015-01-14', 'account_key': '448', 'days_to_cancel': '13'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-03-10', 'is_udacity': 'True', 'join_date': '2015-01-27', 'account_key': '448', 'days_to_cancel': '42'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-27', 'is_udacity': 'True', 'join_date': '2015-01-27', 'account_key': '448', 'days_to_cancel': '0'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-27', 'is_udacity': 'True', 'join_date': '2015-01-27', 'account_key': '448', 'days_to_cancel': '0'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-03-10', 'is_udacity': 'True', 'join_date': '2015-01-10', 'account_key': '1304', 'days_to_cancel': '59'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-06-17', 'is_udacity': 'True', 'join_date': '2015-03-10', 'account_key': '1304', 'days_to_cancel': '99'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-03-10', 'is_udacity': 'True', 'join_date': '2014-11-10', 'account_key': '312', 'days_to_cancel': '120'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-04-01', 'is_udacity': 'True', 'join_date': '2015-03-10', 'account_key': '312', 'days_to_cancel': '22'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-07-02', 'is_udacity': 'True', 'join_date': '2015-04-01', 'account_key': '312', 'days_to_cancel': '92'}
{'is_canceled': 'False', 'status': 'current', 'cancel_date': '', 'is_udacity': 'True', 'join_date': '2015-07-08', 'account_key': '312', 'days_to_cancel': ''}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-01-12', 'is_udacity': 'True', 'join_date': '2015-01-07', 'account_key': '818', 'days_to_cancel': '5'}
{'is_canceled': 'True', 'status': 'canceled', 'cancel_date': '2015-06-01', 'is_udacity': 'True', 'join_date': '2015-06-01', 'account_key': '1069', 'days_to_cancel': '0'}
{'is_canceled': 'False', 'status': 'current', 'cancel_date': '', 'is_udacity': 'True', 'join_date': '2015-02-25', 'account_key': '1101', 'days_to_cancel': ''}

In [2]:
import time
import webbrowser
total_break = 3
break_count = 0
while (total_break < break_count):
    time.sleep(10)
    webbrowser.open("www.youtube.com")
    break_count = break_count + 1

In [22]:
import os
from os import listdir
def list_directory():
    os.chdir(r'/home/moonbury/')
    filelist = os.listdir(r'.')
    print(os.getcwd())
    
    for f in filelist:
        print(f)
        
    
list_directory()


/home/moonbury
face.tx
README.txt
tree.dot
.profile
att_faces.tar.bz2
.pythonstartup.py
.cache
.bash_history
ijcnn1.bz2
feature_selection.py
.jupyter
result
data
naive_bayes
.bashrc
github-book
cloneall.py
github-scikit-learn
Project Euler.ipynb
udacity
.python_history
mysite
.vimrc
.config
cal_pca_face_recognition.ipynb
clear.py
vision_label.py
input_data.py
git_readme.txt
.local
.my.cnf
.gitconfig
data.csv
.ipython
scikit-learn
kaggle
.virtualenvs
.mysql_history
scikit-image
.ipynb_checkpoints
.viminfo
scikit_learn_data

In [15]:



Out[15]:
'hello1234'

In [ ]: