First Jupyter Notebook Post
This is a blog post created in Jupyter notebook.¶
The goal is to see how well this feature works. I'd like to be able to post Python code to my blog. Happily, Nikola supports that seamlessly.
Normally Nikola preserves the width of each notebook cell. It makes sense that it does this but that doesn't work so well with this template because of the navigation bar on the left side of the screen. That's OK, I can override it by changing the notebook styling with this if I need to:
#notebook-container {
width: 800px;
}
And here is some Python code:
In [1]:
def square(x):
return x**2
for i in range(10):
print(square(i))
And a plot:
In [2]:
%matplotlib inline
import matplotlib
import pandas as pd
import pandas.util.testing as pd_testing
In [3]:
df = pd_testing.makeTimeDataFrame(20)
df.index = pd.date_range(start=pd.Timestamp.now().floor('D'), periods=df.shape[0])
df.plot(figsize=(10, 5))
Out[3]:
Magnificent!
Comments