In [ ]:
dreload(data)


Reloading __future__
Reloading numpy
Reloading numpy.__config__
Reloading numpy.version
Reloading numpy._import_tools
Reloading os
Reloading errno
Reloading stat
Reloading _stat
Reloading posix
Reloading posixpath
Reloading genericpath
Reloading _collections_abc
Reloading abc
Reloading _weakrefset
Reloading _weakref
Reloading numpy.testing
Reloading unittest
Reloading unittest.result
Reloading io
Reloading _io
Reloading traceback
Reloading linecache
Reloading tokenize
Reloading codecs
Reloading _codecs
Reloading collections
Reloading _collections
Reloading operator
Reloading _operator
Reloading keyword
Reloading heapq
Reloading itertools
Reloading _heapq
Reloading reprlib
Reloading _thread
Reloading re
Reloading sre_compile
Reloading _sre
Reloading sre_parse
Reloading sre_constants
Reloading _locale
Reloading copyreg
Reloading token
Reloading functools
Reloading _functools
Reloading types
Reloading weakref
Reloading unittest.case
Reloading difflib
Reloading logging
Reloading time
Reloading warnings
Reloading _warnings
Reloading string
Reloading _string
Reloading threading
Reloading atexit
Reloading pprint
Reloading contextlib
Reloading unittest.util
Reloading unittest.suite
Reloading unittest.loader
Reloading fnmatch
Reloading unittest.main
Reloading argparse
Reloading copy
Reloading org
Reloading textwrap
Reloading gettext
Reloading locale
Reloading encodings
Reloading encodings.aliases
Reloading struct
Reloading _struct
Reloading unittest.signals
Reloading signal
Reloading unittest.runner
Reloading numpy.testing.utils
Reloading shutil
Reloading tarfile
Reloading grp
Reloading pwd
Reloading bz2
Reloading _bz2
Reloading tempfile
Reloading random
Reloading math
Reloading hashlib
Reloading _hashlib
Reloading _random
Reloading numpy.testing.nosetester
Reloading numpy.compat
Reloading numpy.compat._inspect
Reloading numpy.compat.py3k
Reloading numpy.core
Reloading numpy.core.info
Reloading numpy.core.numeric
Reloading numpy.core.umath
Reloading numpy.core.numerictypes
Reloading numpy.core.multiarray
Reloading numbers
Reloading pickle
Reloading _compat_pickle
Reloading org
Reloading _pickle
Reloading numpy.core._dotblas
Reloading numpy.core.arrayprint
Reloading numpy.core.fromnumeric
Reloading numpy.core.records
Reloading numpy.core.defchararray
Reloading numpy.core.memmap
Reloading numpy.core.function_base
Reloading numpy.core.machar
Reloading numpy.core.getlimits
Reloading numpy.core.shape_base
Reloading numpy.lib
Reloading numpy.lib.info
Reloading numpy.lib.type_check
Reloading numpy.lib.ufunclike
Reloading numpy.lib.index_tricks
Reloading numpy.matrixlib
Reloading numpy.matrixlib.defmatrix
Reloading numpy.lib.function_base
Reloading numpy.lib.twodim_base
Reloading numpy.lib.utils
Reloading numpy.lib._compiled_base
Reloading numpy.lib.stride_tricks
Reloading numpy.lib.nanfunctions
Reloading numpy.lib.shape_base
Reloading numpy.lib.polynomial
Reloading numpy.linalg
Reloading numpy.linalg.info
Reloading numpy.linalg.linalg
Reloading numpy.lib.arraysetops
Reloading numpy.lib.npyio
Reloading numpy.lib._datasource
Reloading numpy.lib._iotools
Reloading numpy.lib.financial
Reloading numpy.lib.arrayterator
Reloading numpy.lib.arraypad
Reloading numpy.lib._version
Reloading pandas
Reloading datetime
Reloading _datetime
Reloading distutils
Reloading distutils.version
Reloading pandas.version
Reloading pandas.info
Reloading pandas.core
Reloading pandas.core.config_init
Reloading pandas.core.config
Reloading pandas.compat
Reloading __builtin__
Reloading http
Reloading http.client
Reloading email
Reloading email.parser
Reloading email.feedparser
Reloading email._policybase
Reloading email.utils
Reloading socket
Reloading _socket
Reloading enum
Reloading urllib
Reloading urllib.parse
Reloading email._parseaddr
Reloading calendar
Reloading email.charset
Reloading email.base64mime
Reloading base64
Reloading binascii
Reloading email.quoprimime
Reloading email.encoders
Reloading quopri
Reloading email.message
Reloading uu
Reloading email._encoded_words
Reloading email.iterators
Reloading ssl
Reloading _ssl
Reloading pandas.compat.chainmap
Reloading _abcoll
Reloading dateutil
Reloading pandas.core.common
Reloading csv
Reloading _csv
Reloading numpy.lib.format
Reloading pandas.algos
Reloading pandas.lib
Reloading pandas.tslib
Reloading pandas.core.format
Reloading pandas.core.base
Reloading pandas.core.nanops
Reloading bottleneck
Reloading pandas.hashtable
Reloading pandas.util
Reloading pandas.util.decorators
Reloading pandas.core.index
Reloading pandas.index
Reloading pandas.io
Reloading pandas.io.common
Reloading zipfile
Reloading importlib
Reloading _imp
Reloading _frozen_importlib
Reloading importlib._bootstrap
Reloading
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

--- Logging error ---
Traceback (most recent call last):
--- Logging error ---
Traceback (most recent call last):
--- Logging error ---
Traceback (most recent call last):
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

Error in sys.excepthook:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 970, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 233, in wrapped
    return f(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 267, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1338, in getinnerframes
    framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1302, in getframeinfo
    lines, lnum = findsource(frame)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 171, in findsource
    lines = linecache.getlines(file, globals_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

Original exception was:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 3035, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-534e6052d72c>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 341, in reload
    return deep_reload_hook(module)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 311, in deep_reload_hook
    newm = imp.load_module(name, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "data.py", line 4, in <module>
    import pandas as pd
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 252, in deep_import_hook
    head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 215, in load_package
    return methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/__init__.py", line 47, in <module>
    import pandas.core.config_init
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 256, in deep_import_hook
    tail, name, buf = load_next(tail, tail, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/core/config_init.py", line 17, in <module>
    from pandas.core.format import detect_console_encoding
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 256, in deep_import_hook
    tail, name, buf = load_next(tail, tail, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/core/format.py", line 9, in <module>
    from pandas.core.index import Index, MultiIndex, _ensure_index
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 256, in deep_import_hook
    tail, name, buf = load_next(tail, tail, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/core/index.py", line 25, in <module>
    from pandas.io.common import PerformanceWarning
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 256, in deep_import_hook
    tail, name, buf = load_next(tail, tail, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/io/common.py", line 5, in <module>
    import zipfile
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 252, in deep_import_hook
    head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/zipfile.py", line 9, in <module>
    import importlib.util
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 256, in deep_import_hook
    tail, name, buf = load_next(tail, tail, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 201, in import_submodule
    m = imp.load_module(fullname, fp, filename, stuff)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 169, in load_source
    module = methods.exec(sys.modules[name])
  File "<frozen importlib._bootstrap>", line 1153, in exec
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py", line 321, in _call_with_frames_removed
    return f(*args, **kwds)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/util.py", line 3, in <module>
    from ._bootstrap import MAGIC_NUMBER
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 252, in deep_import_hook
    head, name, buf = load_next(parent, None if level < 0 else parent, name, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 156, in load_next
    result = import_submodule(mod, subname, buf)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/lib/deepreload.py", line 196, in import_submodule
    fp, filename, stuff = imp.find_module(subname, path)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/imp.py", line 271, in find_module
    "not {}".format(type(name)))
RuntimeError: 'list' must be None or a list, not <class 'str'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 1848, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'RuntimeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 970, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 233, in wrapped
    return f(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 267, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1338, in getinnerframes
    framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1302, in getframeinfo
    lines, lnum = findsource(frame)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 171, in findsource
    lines = linecache.getlines(file, globals_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 2981, in run_ast_nodes
    if self.run_code(code, result):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 3052, in run_code
    self.showtraceback()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 1851, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1240, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1148, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1000, in structured_traceback
    tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 949, in format_exception_as_a_whole
    records = self.get_records(etb, number_of_lines_of_context, tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 979, in get_records
    traceback.print_exc(file=self.ostream)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 252, in print_exc
    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 1848, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 970, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 233, in wrapped
    return f(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 267, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1338, in getinnerframes
    framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 1302, in getframeinfo
    lines, lnum = findsource(frame)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 171, in findsource
    lines = linecache.getlines(file, globals_dict)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/ipkernel.py", line 181, in do_execute
    shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 2871, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 3000, in run_ast_nodes
    self.showtraceback()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 1851, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1240, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1148, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 1000, in structured_traceback
    tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 949, in format_exception_as_a_whole
    records = self.get_records(etb, number_of_lines_of_context, tb_offset)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/ultratb.py", line 979, in get_records
    traceback.print_exc(file=self.ostream)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 252, in print_exc
    print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 213, in dispatch_shell
    handler(stream, idents, msg)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 362, in execute_request
    user_expressions, allow_stdin)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/ipkernel.py", line 191, in do_execute
    tb_list = traceback.format_exception(etype, evalue, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 181, in format_exception
    return list(_format_exception_iter(etype, value, tb, limit, chain))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 978, in emit
    msg = self.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 828, in format
    return fmt.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/config/application.py", line 104, in format
    return super(LevelFormatter, self).format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 573, in format
    record.exc_text = self.formatException(record.exc_info)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 523, in formatException
    traceback.print_exception(ei[0], ei[1], tb, None, sio)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
    callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 252, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 215, in dispatch_shell
    self.log.error("Exception in message handler:", exc_info=True)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1303, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1409, in _log
    self.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1419, in handle
    self.callHandlers(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1481, in callHandlers
    hdlr.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 853, in handle
    self.emit(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 984, in emit
    self.handleError(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 906, in handleError
    traceback.print_exception(t, v, tb, None, sys.stderr)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 978, in emit
    msg = self.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 828, in format
    return fmt.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 573, in format
    record.exc_text = self.formatException(record.exc_info)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 523, in formatException
    traceback.print_exception(ei[0], ei[1], tb, None, sio)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 568, in _run_callback
    ret = callback()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 234, in enter_eventloop
    self.eventloop(self)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/eventloops.py", line 251, in loop_cocoa
    kernel.do_one_iteration()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelbase.py", line 267, in do_one_iteration
    stream.flush(zmq.POLLIN, 1)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py", line 345, in flush
    self._handle_recv()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
    self._run_callback(callback, msg)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/zmqstream.py", line 410, in _run_callback
    exc_info=True)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1303, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1409, in _log
    self.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1419, in handle
    self.callHandlers(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1481, in callHandlers
    hdlr.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 853, in handle
    self.emit(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 984, in emit
    self.handleError(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 906, in handleError
    traceback.print_exception(t, v, tb, None, sys.stderr)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 978, in emit
    msg = self.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 828, in format
    return fmt.format(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 573, in format
    record.exc_text = self.formatException(record.exc_info)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 523, in formatException
    traceback.print_exception(ei[0], ei[1], tb, None, sio)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/__main__.py", line 3, in <module>
    app.launch_new_instance()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/config/application.py", line 574, in launch_instance
    app.start()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/kernel/zmq/kernelapp.py", line 373, in start
    ioloop.IOLoop.instance().start()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/zmq/eventloop/ioloop.py", line 151, in start
    super(ZMQIOLoop, self).start()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 784, in start
    self._run_callback(callback)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 576, in _run_callback
    self.handle_callback_exception(callback)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/tornado/ioloop.py", line 588, in handle_callback_exception
    app_log.error("Exception in callback %r", callback, exc_info=True)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1303, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1409, in _log
    self.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1419, in handle
    self.callHandlers(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 1481, in callHandlers
    hdlr.handle(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 853, in handle
    self.emit(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 984, in emit
    self.handleError(record)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py", line 906, in handleError
    traceback.print_exception(t, v, tb, None, sys.stderr)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 169, in print_exception
    for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 153, in _format_exception_iter
    yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 18, in _format_list_iter
    for filename, lineno, name, line in extracted_list:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
    line = linecache.getline(filename, lineno, f.f_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 15, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 41, in getlines
    return updatecache(filename, module_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/linecache.py", line 126, in updatecache
    with tokenize.open(fullname) as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given
 importlib.util
Reloading importlib.util._bootstrap
Traceback (most recent call last):
Traceback (most recent call last):

In [2]:
import data
datasets, df = data.load_datasets()


Extracting features for UVA
-- missing 2/1010 feature values for Volume
-- missing 1/1010 feature values for Embo
Sex                             int64
Age                           float64
SM_Vein                         int64
Max_Diameter                  float64
Volume                        float64
History_of_Hemorrhage           int64
Embo                          float64
Aneurysm                      float64
Max_Dose                      float64
Marginal_Dose                 float64
Isodose                       float64
Shots                         float64
Surgery                          bool
Location_frontal                 bool
Location_2                       bool
Location_3                       bool
Location_4                       bool
Location_5                       bool
Location_6                       bool
Location_7                       bool
Location_8                       bool
Location_9                       bool
Marginal_Dose_times_Volume    float64
Marginal_Dose_times_area      float64
dtype: object
-- Row-wise feature mask len=1010, type=<class 'numpy.ndarray'>, dtype=bool, sum=1007
# censored at 4.000000 years: 100 / 1010
-- Followup mask len=1010, type=<class 'numpy.ndarray'>, dtype=bool, sum=910
-- Total patients=1010, Complete patient rows=1007, Patients with sufficient followup=910, Dataset size=907
X (907, 24) float64
oblit (907,) bool
H 76
RIC 365
RIC Permanet 26
Extracting features for PA
-- missing 2/800 feature values for Aneurysm
-- missing 7/800 feature values for Shots
Sex                             int64
Age                           float64
SM_Vein                         int64
Max_Diameter                  float64
Volume                        float64
History_of_Hemorrhage           int64
Embo                          float64
Aneurysm                      float64
Max_Dose                      float64
Marginal_Dose                 float64
Isodose                       float64
Shots                         float64
Surgery                          bool
Location_frontal                 bool
Location_2                       bool
Location_3                       bool
Location_4                       bool
Location_5                       bool
Location_6                       bool
Location_7                       bool
Location_8                       bool
Location_9                       bool
Marginal_Dose_times_Volume    float64
Marginal_Dose_times_area      float64
dtype: object
-- Row-wise feature mask len=800, type=<class 'numpy.ndarray'>, dtype=bool, sum=793
# censored at 4.000000 years: 259 / 800
-- Followup mask len=800, type=<class 'numpy.ndarray'>, dtype=bool, sum=541
-- Total patients=800, Complete patient rows=793, Patients with sufficient followup=541, Dataset size=535
X (535, 24) float64
oblit (535,) bool
H 64
RIC 124
RIC Permanet 13

In [3]:
X_pa, Y_pa, _, _, df_pa = datasets['pa'] 
X_uva, Y_uva, _, _, df_uva = datasets['uva']

In [4]:
df_uva.median(axis=0)


Out[4]:
Sex                             1.000000
Age                             5.041997
SM_Vein                         1.000000
Max_Diameter                   22.000000
Volume                          2.760000
History_of_Hemorrhage           1.000000
Embo                            0.000000
Aneurysm                        0.000000
Max_Dose                       40.000000
Marginal_Dose                  22.000000
Isodose                        50.000000
Shots                           2.000000
Surgery                         0.000000
Location_frontal                0.000000
Location_2                      0.000000
Location_3                      0.000000
Location_4                      0.000000
Location_5                      0.000000
Location_6                      0.000000
Location_7                      0.000000
Location_8                      0.000000
Location_9                      0.000000
Marginal_Dose_times_Volume     58.000000
Marginal_Dose_times_area      199.382080
dtype: float64

In [5]:
import sklearn.linear_model
rf = sklearn.ensemble.RandomForestClassifier(n_estimators=200)
rf.fit(X_uva, Y_uva)
Y_prob = rf.predict_proba(X_pa)
Y_pred = rf.predict(X_pa)
np.mean(Y_pred == Y_pa)


Out[5]:
0.58878504672897192

In [6]:
import seaborn;
seaborn.plt.hexbin(df_pa.Isodose, df_pa.Marginal_Dose, gridsize=20)


Out[6]:
<matplotlib.collections.PolyCollection at 0x10a7b83c8>

In [13]:
X_pa, Y_pa, df_pa = datasets['pa'][:3]
X_uva, Y_uva, df_uva = datasets['uva'][:3]

In [14]:
df_pa.columns


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-3712cb830e1e> in <module>()
----> 1 df_pa.columns

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pandas/core/generic.py in __getattr__(self, name)
   1971                 or name in self._metadata
   1972                 or name in self._accessors):
-> 1973             return object.__getattribute__(self, name)
   1974         else:
   1975             if name in self._info_axis:

AttributeError: 'Series' object has no attribute 'columns'

In [ ]:


In [1]:
candidate_models = {}
Cs = [10.0 ** -6, 10.0 ** -5, 0.0001, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10]
lr_parameter_grids = [
    {
         'penalty' : ['l1', 'l2'],
         'fit_intercept' : [True, False],
         'C' : Cs, 
    }
]
lr = sklearn.linear_model.LogisticRegression()
candidate_models[lr] = lr_parameter_grids

rf_parameter_grids = [
    {
        'min_samples_split' : [1, 2, 4, 8],
        'max_depth' : [10, 20, 30, None],
        'n_estimators' : [25, 50, 100, 200, 300],
     }
]
rf = sklearn.ensemble.RandomForestClassifier()
candidate_models[rf] = rf_parameter_grids

In [2]:
X_uva, Y_uva  = datasets['uva'][:2]
X_pa, Y_pa = datasets['pa'][:2]


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-75df135d8ad1> in <module>()
----> 1 X_uva, Y_uva  = datasets['uva'][:2]
      2 X_pa, Y_pa = datasets['pa'][:2]
      3 
      4 X_combined = np.vstack([X_uva, X_pa])
      5 Y_combined = np.hstack([Y_uva, Y_pa])

NameError: name 'datasets' is not defined

In [ ]:
import cv
reload(cv)
best_model, params, auc = cv.find_best_model(
  X_combined,
  Y_combined,
  # sklearn.linear_model.LogisticRegression, lr_parameter_grids
  sklearn.ensemble.RandomForestClassifier, 
  rf_parameter_grids, 
  target_value=2)

In [ ]:
best_model, params, auc

In [ ]:
lr = sklearn.linear_model.LogisticRegression(C=0.1, penalty='l1'); 
m = X_train.mean(axis=0)
X_train_normalized = X_train - m
s = X_train_normalized.std(axis=0)
s[s==0] = 1
X_train_normalized /= s
lr.fit(X_train_normalized, Y_train)

In [ ]:
pred = lr.predict(X_train_normalized)

In [ ]:
(pred == Y_train).mean()

In [ ]:
_, idx = np.where(lr.coef_ != 0)

In [ ]:
df_uva = datasets['uva'][-1]
uva_features = list(df_uva.columns)
[uva_features[i] for i in set(idx)]

In [ ]:
cv.roc_auc_score(Y_test, Y_pred[:, -1])

In [ ]:
params

In [ ]:
best_model.model.coef_

In [ ]:
[datasets['features'][i] for (i, x) in enumerate(best_model.model.coef_.ravel()) if abs(x) > 0]

In [3]:
best_model


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-b964832987f8> in <module>()
----> 1 best_model

NameError: name 'best_model' is not defined

In [ ]:


In [ ]: