In [1]:
from __future__ import print_function, division
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import pandas as pd
import textwrap
import os
import sys
import warnings
warnings.filterwarnings('ignore')
# special things
from pivottablejs import pivot_ui
from ipywidgets import FloatSlider, interactive, IntSlider
from scipy import interpolate
# sql
%load_ext sql_magic
import sqlalchemy
import sqlite3
from sqlalchemy import create_engine
sqlite_engine = create_engine('sqlite://')
# autoreload
%load_ext autoreload
%autoreload 1
# %aimport module_to_reload
# ehh...
# import bqplot.pyplot as plt
import ipyvolume as ipv
import altair as alt
from vega_datasets import data
import seaborn as sns
sns.set_context('poster', font_scale=1.3)
In [2]:
a = "hi"
b = np.array([1, 2, 4, 6])
In [ ]:
https://github.com/jupyter/nbdime
and the documentation about adding the nbdime https://nbdime.readthedocs.io/en/latest/extensions.html
In [3]:
print("hello world")
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [5]:
a = 4
report = "FAIL"
Copy/paste the following into the "json defining library calls required to load the kernel-specific prettifying modules, and the prefix & postfix for the json-format string required to make the prettifying call." box.
{
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
},
"r": {
"library": "library(formatR)\nlibrary(jsonlite)",
"prefix": "cat(toJSON(paste(tidy_source(text=",
"postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))"
},
"javascript": {
"library": "jsbeautify = require('js-beautify')",
"prefix": "console.log(JSON.stringify(jsbeautify.js_beautify(",
"postfix": ")));"
}
}
In [ ]:
weight_categories = [ "vlow_weight", "low_weight",
"mid_weight", "high_weight",
"vhigh_weight",]
players['weightclass'] = pd.qcut(players['weight'],
len(weight_categories), weight_categories)
In [ ]:
weight_categories = [
"vlow_weight",
"low_weight",
"mid_weight",
"high_weight",
"vhigh_weight",
]
players["weightclass"] = pd.qcut(
players["weight"], len(weight_categories), weight_categories
)
In [ ]:
In [ ]:
In [ ]:
In [6]:
import time
time.sleep(10)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: