-
Notifications
You must be signed in to change notification settings - Fork 91
/
demo.py
76 lines (62 loc) · 1.51 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
from IPython import get_ipython
# %% [markdown]
# # Demonstration
#
# This file is used to demonstrate interacting with Jupyter notebooks
# in
#
# * VS Code
# * PyCharm Professional
# * Jupyter notebook server
#
# This code is used to illustrate the behavior of each of the platforms
# and. It is not necessary to understand the code itself at the beginning
# of the course. The introduction will provide explanation of code used
# here.
# %%
import numpy as np
x = 2 * np.pi
print(f"The value of 2π is {2 * np.pi}")
# %%
import pandas as pd
df = pd.read_csv("data/momentum.csv", parse_dates=True, index_col="date")
df.head()
# %%
get_ipython().run_line_magic('matplotlib', 'inline')
import matplotlib.pyplot as plt
import seaborn
plt.rc("figure", figsize=(16,6))
seaborn.set_style("darkgrid")
e = np.random.standard_normal(100)
y = np.cumsum(e)
ax = plt.plot(y)
# %% [markdown]
# # Title
# ## Chapter
# ### Section
#
# This is an example of a markdown cell. You can use **bold**, _italics_, and
# `monospace` formatting. You can also have code blocks.
#
# ```python
# for i in range(10):
# print(i)
# ```
#
# Markdown cells also support both inline math, $\alpha+\beta=\gamma$ or entire
# lines,
#
# $$ f(x) = \frac{1}{2\pi}\exp\left(-\frac{x^2}{2}\right),$$
#
# using $\LaTeX$ code.
#
# You can also include tables,
#
# | Parameter | Value |
# |-----------|-------|
# | $\alpha$ | 0.05 |
# | $\beta$ | 0.90 |
# %%