Open in CoCalc
1
## -*- encoding: utf-8 -*-
2
## This file (data.sagetex.sage) was *autogenerated* from data.tex with sagetex.sty version 2015/08/26 v3.0-92d9f7a.
3
import sagetex
4
_st_ = sagetex.SageTeXProcessor('data', version='2015/08/26 v3.0-92d9f7a', version_check=True)
5
_st_.current_tex_line = 11
6
_st_.blockbegin()
7
try:
8
t = r"""
9
\begin{tabular}{ll}
10
col1 & col2 \\
11
1 & 2 \\
12
3 & 4 via sagestr
13
\end{tabular}
14
"""
15
except:
16
_st_.goboom(19)
17
_st_.blockend()
18
try:
19
_st_.current_tex_line = 24
20
_st_.inline(0, "foo")
21
except:
22
_st_.goboom(24)
23
try:
24
_st_.current_tex_line = 26
25
_st_.inline(1, t)
26
except:
27
_st_.goboom(26)
28
_st_.current_tex_line = 30
29
_st_.blockbegin()
30
try:
31
t2 = []
32
t2.append(r"\begin{tabular}{ll}")
33
t2.append(r"col1 & col2 \\")
34
t2.append(r"1 & 2 \\")
35
t2.append(r"3 & 4")
36
t2.append(r"\end{tabular}")
37
t2 = "\n".join(t2)
38
except:
39
_st_.goboom(38)
40
_st_.blockend()
41
try:
42
_st_.current_tex_line = 40
43
_st_.inline(2, t2)
44
except:
45
_st_.goboom(40)
46
_st_.current_tex_line = 44
47
_st_.blockbegin()
48
try:
49
import statsmodels.api as sm
50
import pandas as pd
51
ds = sm.datasets.grunfeld.load_pandas()
52
pt = ds.data[ds.data.year > 1950]\
53
.pivot_table(\
54
values=["invest"],\
55
index=["firm"],\
56
columns=["year"])
57
except:
58
_st_.goboom(53)
59
_st_.blockend()
60
try:
61
_st_.current_tex_line = 61
62
_st_.inline(3, pt.to_latex())
63
except:
64
_st_.goboom(61)
65
_st_.endofdoc()
66