In [ ]:
!conda install --yes --c conda-forge ipywidgets numpy pandas nomkl seaborn ipywidgets jupyter
In [1]:
import numpy
In [2]:
numpy.ones((2, 3))
Out[2]:
In [3]:
a = numpy.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])
a
Out[3]:
In [4]:
a.shape
Out[4]:
In [5]:
a.ndim
Out[5]:
In [6]:
a.size
Out[6]:
In [7]:
a - numpy.random.random(a.shape)
Out[7]:
In [8]:
a.ravel()
Out[8]:
In [9]:
a
Out[9]:
In [10]:
a[1:-1]
Out[10]:
In [11]:
'>qwweqwe<'[1:-1]
Out[11]:
In [12]:
a
Out[12]:
In [13]:
a[:,1]
Out[13]:
In [14]:
a[a % 2 == 0] = -1
In [15]:
a
Out[15]:
In [16]:
import pandas
In [17]:
boston_dataset = pandas.read_csv("../static/Boston.csv")
In [18]:
boston_dataset[:10]
Out[18]:
In [19]:
boston_dataset[boston_dataset['MV'] < 7]
Out[19]:
In [20]:
boston_dataset['TARGET'] = boston_dataset['MV'].astype(int)
In [21]:
boston_dataset[:10]
Out[21]:
In [22]:
%pylab inline
import seaborn
seaborn.set_context('talk')
In [23]:
boston_dataset['MV'].hist(bins=50);
In [24]:
def plot_by(dataset, column='MV', bins_count=10):
plot = boston_dataset[column].hist(bins=bins_count)
# Plot settings.
pyplot.title('%s Values' % column)
pyplot.ylabel('N')
from ipywidgets import interact, fixed
interact(
plot_by,
dataset=fixed(boston_dataset),
column=boston_dataset.columns.tolist(),
bins_count=(5,50)
);
In [ ]: