In [1]:
import os
os.chdir('..')

In [2]:
import pandas as pd

In [3]:
%load_ext autoreload
%autoreload 1
%aimport crossfilter

In [4]:
from crossfilter import *

In [5]:
load_resources()



In [6]:
airq = pd.read_csv("https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/datasets/airquality.csv", 
                 index_col=0)

In [7]:
airq.head()


Out[7]:
Ozone Solar.R Wind Temp Month Day
1 41 190 7.4 67 5 1
2 36 118 8.0 72 5 2
3 12 149 12.6 74 5 3
4 18 313 11.5 62 5 4
5 NaN NaN 14.3 56 5 5

In [8]:
airq.dtypes


Out[8]:
Ozone      float64
Solar.R    float64
Wind       float64
Temp         int64
Month        int64
Day          int64
dtype: object

In [9]:
Crossfilter(airq, width=310, height=160)


Out[9]:

In [10]:
iris = pd.read_csv("https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/datasets/iris.csv", 
                 index_col=0)

In [11]:
iris.head()


Out[11]:
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa

In [12]:
iris['Species'] = iris['Species'].astype('category')

In [13]:
Crossfilter(iris, width=310, height=160)


Out[13]:

In [17]:
df = df.head(5).copy()

In [36]:
df.to_json()


Out[36]:
'{"Sepal.Length":{"1":5.1,"2":4.9,"3":4.7,"4":4.6,"5":5.0},"Sepal.Width":{"1":3.5,"2":3.0,"3":3.2,"4":3.1,"5":3.6},"Petal.Length":{"1":1.4,"2":1.4,"3":1.3,"4":1.5,"5":1.4},"Petal.Width":{"1":0.2,"2":0.2,"3":0.2,"4":0.2,"5":0.2},"Species":{"1":"setosa","2":"setosa","3":"setosa","4":"setosa","5":"setosa"}}'

In [32]:
type(iris['Species'].get_values())


Out[32]:
numpy.ndarray

In [ ]: