Jupyter-to-Tex/Example.ipynb

5.4 KiB

In [1]:
# Some configs that should not be shown!
import warnings

warnings.simplefilter(action="ignore", category=FutureWarning)

Start here

First headline

Some nice text!

In [2]:
!pip install pandas==1.5.2 -q
!pip install matplotlib==3.6.2 -q
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

Import the classes necessary to run the software.

In [3]:
import pandas as pd
import numpy as np

import matplotlib.pyplot as plt

A bit of sample code!

In [4]:
a = 1
for i in range(1, 10):
    a *= i
a
Out[4]:
362880

Acces a document by key.

In [5]:
# get a document by key
some_dict = {"test": 1, "more content": "some_more1", "more content1": "some_more2"}
some_dict
Out[5]:
{'test': 1, 'more content': 'some_more1', 'more content1': 'some_more2'}

Pandas Example!

In [6]:
df = pd.DataFrame([some_dict] * 10)
print(df.head().to_latex())
\begin{tabular}{lrll}
\toprule
{} &  test & more content & more content1 \\
\midrule
0 &     1 &   some\_more1 &    some\_more2 \\
1 &     1 &   some\_more1 &    some\_more2 \\
2 &     1 &   some\_more1 &    some\_more2 \\
3 &     1 &   some\_more1 &    some\_more2 \\
4 &     1 &   some\_more1 &    some\_more2 \\
\bottomrule
\end{tabular}

In [14]:
%%capture
N = 400
t = np.linspace(0, 2 * np.pi, N)
r = 0.5 + np.cos(t)
x, y = r * np.cos(t), r * np.sin(t)

fig, ax = plt.subplots()
ax.plot(x, y, "k")
ax.set(aspect=1)
plt.show()
plt.savefig("diagramm.png")

End here

This should not be shown!

In [7]: