<jupyter_start><jupyter_text>Advanced Notebook<jupyter_code>%matplotlib inline

import numpy as np
import pandas as pd
from pandas.tools.plotting import scatter_matrix
from sklearn.datasets import load_boston
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('poster')
sns.set_style('whitegrid')
plt.rcParams['figure.figsize'] = 12, 8  # plotsize


import warnings
warnings.filterwarnings('ignore')
df_dict = load_boston()
features = pd.DataFrame(data=df_dict.data, columns = df_dict.feature_names)
target = pd.DataFrame(data=df_dict.target, columns = ['MEDV'])
df = pd.concat([features, target], axis=1)
df['Zone'] = df['ZN'].astype('category')
df.head()<jupyter_output><empty_output><jupyter_text>QGridInteractive pandas dataframes: https://github.com/quantopian/qgrid<jupyter_code>import qgrid
qgrid_widget = qgrid.show_grid(df[['CRIM',
                                   'Zone',
                                   'INDUS',
#                                    'CHAS',
                                   'NOX',
#                                    'RM',
                                   'AGE',
#                                    'DIS',
                                   'RAD',
                                   'TAX',
#                                    'PTRATIO',
#                                    'B',
                                   'LSTAT',
                                   'MEDV',
                                  ]], show_toolbar=True)
qgrid_widget
df2 = qgrid_widget.get_changed_df()
df2.head()<jupyter_output><empty_output><jupyter_text>BQPlotExamples here are shamelessly stolen from the amazing: https://github.com/maartenbreddels/jupytercon-2017/blob/master/jupytercon2017-widgets.ipynb<jupyter_code># mixed feelings about this import
import bqplot.pyplot as plt
import numpy as np
x = np.linspace(0, 2, 50)
y = x**2
fig = plt.figure()
scatter = plt.scatter(x, y)
plt.show()
fig.animation_duration = 500
scatter.y = 2 * x**.5
scatter.selected_style = {'stroke':'red', 'fill': 'orange'}
plt.brush_selector();
scatter.selected
scatter.selected = [1,2,10,40]<jupyter_output><empty_output><jupyter_text>ipyvolume<jupyter_code>import ipyvolume as ipv
N = 1000
x, y, z = np.random.random((3, N))
fig = ipv.figure()
scatter = ipv.scatter(x, y, z, marker='box')
ipv.show()
scatter.x = scatter.x - 0.5
scatter.x = x
scatter.color = "green"
scatter.size = 5
scatter.color = np.random.random((N,3))
scatter.size = 2
ex = ipv.datasets.animated_stream.fetch().data
ex.shape
ex[:, ::, ::4].shape
ipv.figure()
ipv.style.use('dark')
quiver = ipv.quiver(*ipv.datasets.animated_stream.fetch().data[:,::,::4], size=5)
ipv.animation_control(quiver, interval=200)
ipv.show()
ipv.style.use('light')
ipv.style.use('light')
quiver.geo = "cat"
N = 1000*1000
x, y, z = np.random.random((3, N)).astype('f4')
ipv.figure()
s = ipv.scatter(x, y, z, size=0.2)
ipv.show()
ipv.save("3d-example-plot.html")
!open 3d-example-plot.html<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1411451398135819, 'fraction_numerical': 0.019973368841544607, 'mean_word_length': 2.6292270531400965, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '491860', 'license': 'MIT', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1031, 'n_words': 192, 'path': 'notebooks/Advanced-Notebook-Tricks.ipynb', 'repo_name': 'ashishpatel26/jupyter-tips-and-tricks', 'size': '3004'}