In [1]:
import pandas as pd
import ibmcognitive

cars = pd.read_csv("data/cars.csv")


:0: FutureWarning: IPython widgets are experimental and may change in the future.

In [2]:
brunel x(horsepower) y(mpg)  tooltip(#row)  point :: width=800, height=400


---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1173             try:
-> 1174                 h.request(req.get_method(), req.selector, req.data, headers)
   1175             except OSError as err: # timeout error

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in request(self, method, url, body, headers)
   1089         """Send a complete request to the server."""
-> 1090         self._send_request(method, url, body, headers)
   1091 

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in _send_request(self, method, url, body, headers)
   1127             body = body.encode('iso-8859-1')
-> 1128         self.endheaders(body)
   1129 

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in endheaders(self, message_body)
   1085             raise CannotSendHeader()
-> 1086         self._send_output(message_body)
   1087 

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in _send_output(self, message_body)
    923             message_body = None
--> 924         self.send(msg)
    925         if message_body is not None:

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in send(self, data)
    858             if self.auto_open:
--> 859                 self.connect()
    860             else:

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py in connect(self)
    835         self.sock = self._create_connection((self.host,self.port),
--> 836                                             self.timeout, self.source_address)
    837 

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py in create_connection(address, timeout, source_address)
    508     if err is not None:
--> 509         raise err
    510     else:

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py in create_connection(address, timeout, source_address)
    499                 sock.bind(source_address)
--> 500             sock.connect(sa)
    501             return sock

ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-2-d60d69d0eaba> in <module>()
----> 1 get_ipython().magic('brunel x(horsepower) y(mpg)  tooltip(#row)  point :: width=800, height=400')

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
   2305         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2306         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2307         return self.run_line_magic(magic_name, magic_arg_s)
   2308 
   2309     #-------------------------------------------------------------------------

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
   2226                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2227             with self.builtin_trap:
-> 2228                 result = fn(*args,**kwargs)
   2229             return result
   2230 

/Users/graham/Projects/Cognitive/brunel/python/ibmcognitive/magics.py in brunel(self, line, cell)

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194 
    195         if callable(arg):

/Users/graham/Projects/Cognitive/brunel/python/ibmcognitive/magics.py in brunel(self, line, cell)
     42         if data is None:
     43             data = self.best_match(self.get_vars(action), list(datas.values()))
---> 44         return brunel.display(action, data, width, height, output)
     45 
     46 

/Users/graham/Projects/Cognitive/brunel/python/org/brunel.py in display(brunel, data, width, height, output)
     64     elif output == 'd3':
     65         queryParams['visid'] = visid
---> 66         response = brunel_service_call(BRUNEL_BASEURL + '/d3?', queryParams, csv)
     67         return d3_output(response, visid, width, height)
     68     else:

/Users/graham/Projects/Cognitive/brunel/python/org/brunel.py in brunel_service_call(baseURL, queryParams, data, attempts, sleep)
     76     try:
     77         req = urllib.request.Request(url, data, headers)
---> 78         response = urllib.request.urlopen(req)
     79         return response
     80     except HTTPError as e:

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault)
    151     else:
    152         opener = _opener
--> 153     return opener.open(url, data, timeout)
    154 
    155 def install_opener(opener):

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in open(self, fullurl, data, timeout)
    453             req = meth(req)
    454 
--> 455         response = self._open(req, data)
    456 
    457         # post-process response

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in _open(self, req, data)
    471         protocol = req.type
    472         result = self._call_chain(self.handle_open, protocol, protocol +
--> 473                                   '_open', req)
    474         if result:
    475             return result

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    431         for handler in handlers:
    432             func = getattr(handler, meth_name)
--> 433             result = func(*args)
    434             if result is not None:
    435                 return result

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in http_open(self, req)
   1200 
   1201     def http_open(self, req):
-> 1202         return self.do_open(http.client.HTTPConnection, req)
   1203 
   1204     http_request = AbstractHTTPHandler.do_request_

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1174                 h.request(req.get_method(), req.selector, req.data, headers)
   1175             except OSError as err: # timeout error
-> 1176                 raise URLError(err)
   1177             r = h.getresponse()
   1178         except:

URLError: <urlopen error [Errno 61] Connection refused>

In [ ]:
brunel  x(horsepower) y(mpg) color(origin) tooltip(#all)  :: width=300, height=400

In [ ]:
brunel x(horsepower) y(mpg) color(#selection) legends(none) |  bar x(origin) y(acceleration) mean(acceleration)  color(#selection)  interaction(select) legends(none) :: output=d3, width=900

In [ ]:
import os
os.environ.get('BRUNEL_SERVER')