!conda install --yes --c conda-forge ipywidgets numpy pandas nomkl seaborn ipywidgets jupyter

import numpy

numpy.ones((2, 3))

a = numpy.array([[1,2,3], [4,5,6], [7,8,9], [10, 11, 12]])
a

a.shape

a.ndim

a.size

a - numpy.random.random(a.shape)

a.ravel()

a

a[1:-1]

'>qwweqwe<'[1:-1]

a

a[:,1]

a[a % 2 == 0] = -1

a

"""
Explanation: Numpy and Pandas
Numpy
NumPy is the fundamental package for scientific computing with Python.
http://www.numpy.org/
It contains among other things:

a powerful N-dimensional array object
useful linear algebra, Fourier transform, and random number capabilities
tools for integrating C/C++ and Fortran code
End of explanation
"""


import pandas

boston_dataset = pandas.read_csv("../static/Boston.csv")

boston_dataset[:10]

boston_dataset[boston_dataset['MV'] < 7]

boston_dataset['TARGET'] = boston_dataset['MV'].astype(int)

boston_dataset[:10]

%pylab inline

import seaborn
seaborn.set_context('talk')

"""
Explanation: Pandas
Pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
http://pandas.pydata.org/
It features:

A fast and efficient DataFrame object for data manipulation with integrated indexing;
Tools for reading and writing data between in-memory data structures and different formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format;
Intelligent label-based slicing, fancy indexing, and subsetting of large data sets;
Aggregating or transforming data with a powerful group by engine allowing split-apply-combine operations on data sets.
End of explanation
"""


boston_dataset['MV'].hist(bins=50);

"""
Explanation: Plot a histogram with 50 bins
End of explanation
"""


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)
);

"""
Explanation: Jupyter Notebook interactive features
End of explanation
"""


