Code cells¶
This first code cells have some tags
In [1]:
Copied!
a = 1
a = 1
In [2]:
Copied!
a
a
Out[2]:
1
In [3]:
Copied!
b = 'pew'
b = 'pew'
In [4]:
Copied!
b
b
Out[4]:
'pew'
In [5]:
Copied!
import re
import re
In [6]:
Copied!
text = 'foo bar\t baz \tqux'
text = 'foo bar\t baz \tqux'
In [7]:
Copied!
re.split('\s+', text)
re.split('\s+', text)
Out[7]:
['foo', 'bar', 'baz', 'qux']
Equations¶
In [8]:
Copied!
%%latex
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
%%latex
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
\begin{align}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
Pandas DataFrames¶
In [9]:
Copied!
import numpy as np
import pandas as pd
import numpy as np
import pandas as pd
In [10]:
Copied!
dates = pd.date_range('20130101', periods=6)
df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD'))
df
dates = pd.date_range('20130101', periods=6)
df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD'))
df
Out[10]:
A | B | C | D | |
---|---|---|---|---|
2013-01-01 | -0.381074 | -0.461364 | 0.337276 | 0.749400 |
2013-01-02 | 0.971930 | 0.790364 | 0.863955 | -2.754741 |
2013-01-03 | -0.952607 | 1.059292 | -0.003268 | -1.314800 |
2013-01-04 | -0.097368 | 0.428709 | 0.002023 | 1.227811 |
2013-01-05 | -0.550313 | -1.212144 | -0.776761 | -2.175846 |
2013-01-06 | -0.762908 | 0.339352 | 1.050517 | 0.964249 |
Plots¶
In [11]:
Copied!
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
In [12]:
Copied!
from pylab import *
from pylab import *
In [13]:
Copied!
x = linspace(0, 5, 10)
y = x ** 2
x = linspace(0, 5, 10)
y = x ** 2
In [14]:
Copied!
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()
In [15]:
Copied!
num_points = 130
y = np.random.random(num_points)
plt.plot(y)
num_points = 130
y = np.random.random(num_points)
plt.plot(y)
Out[15]:
[<matplotlib.lines.Line2D at 0x7ffbb8474ac0>]
This is some text, here comes some latex
bokeh¶
In [16]:
Copied!
from bokeh.plotting import figure, output_notebook, show
from bokeh.plotting import figure, output_notebook, show
In [18]:
Copied!
p = figure()
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)
p = figure()
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2)
show(p)
plotly¶
This requires a theme modification to include Require.JS
In [19]:
Copied!
import plotly.express as px
import plotly.express as px
In [20]:
Copied!
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length")
fig.show()
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length")
fig.show()
Widgets¶
In [21]:
Copied!
import ipywidgets as widgets
import ipywidgets as widgets
In [22]:
Copied!
widget = widgets.IntSlider(
value=7,
min=0,
max=10,
step=1,
description='',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='d'
)
value_lbl = widgets.Label()
widgets.jslink((widget, 'value'), (value_lbl, 'value'))
display(widget, widgets.HBox([widgets.Label("Current Value:"), value_lbl]) )
widget = widgets.IntSlider(
value=7,
min=0,
max=10,
step=1,
description='',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='d'
)
value_lbl = widgets.Label()
widgets.jslink((widget, 'value'), (value_lbl, 'value'))
display(widget, widgets.HBox([widgets.Label("Current Value:"), value_lbl]) )
IntSlider(value=7, continuous_update=False, max=10)
HBox(children=(Label(value='Current Value:'), Label(value='')))