Sharedlatex-tests / data.sagetex.sage.pyOpen in CoCalc
Authors: harald @schil.ly, Testing CoCalc, John Jeng, Harald Schilly, Harald Schilly, ℏal Snyder, William A. Stein
1
## -*- encoding: utf-8 -*-
2
3
# This file was *autogenerated* from the file data.sagetex.sage
4
from sage.all_cmdline import * # import sage library
5
6
_sage_const_40 = Integer(40); _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_0 = Integer(0); _sage_const_44 = Integer(44); _sage_const_61 = Integer(61); _sage_const_3 = Integer(3); _sage_const_53 = Integer(53); _sage_const_38 = Integer(38); _sage_const_11 = Integer(11); _sage_const_30 = Integer(30); _sage_const_19 = Integer(19); _sage_const_1950 = Integer(1950); _sage_const_26 = Integer(26); _sage_const_24 = Integer(24)## This file (data.sagetex.sage) was *autogenerated* from data.tex with sagetex.sty version 2015/08/26 v3.0-92d9f7a.
7
import sagetex
8
_st_ = sagetex.SageTeXProcessor('data', version='2015/08/26 v3.0-92d9f7a', version_check=True)
9
_st_.current_tex_line = _sage_const_11
10
_st_.blockbegin()
11
try:
12
t = r"""
13
\begin{tabular}{ll}
14
col1 & col2 \\
15
1 & 2 \\
16
3 & 4 via sagestr
17
\end{tabular}
18
"""
19
except:
20
_st_.goboom(_sage_const_19 )
21
_st_.blockend()
22
try:
23
_st_.current_tex_line = _sage_const_24
24
_st_.inline(_sage_const_0 , "foo")
25
except:
26
_st_.goboom(_sage_const_24 )
27
try:
28
_st_.current_tex_line = _sage_const_26
29
_st_.inline(_sage_const_1 , t)
30
except:
31
_st_.goboom(_sage_const_26 )
32
_st_.current_tex_line = _sage_const_30
33
_st_.blockbegin()
34
try:
35
t2 = []
36
t2.append(r"\begin{tabular}{ll}")
37
t2.append(r"col1 & col2 \\")
38
t2.append(r"1 & 2 \\")
39
t2.append(r"3 & 4")
40
t2.append(r"\end{tabular}")
41
t2 = "\n".join(t2)
42
except:
43
_st_.goboom(_sage_const_38 )
44
_st_.blockend()
45
try:
46
_st_.current_tex_line = _sage_const_40
47
_st_.inline(_sage_const_2 , t2)
48
except:
49
_st_.goboom(_sage_const_40 )
50
_st_.current_tex_line = _sage_const_44
51
_st_.blockbegin()
52
try:
53
import statsmodels.api as sm
54
import pandas as pd
55
ds = sm.datasets.grunfeld.load_pandas()
56
pt = ds.data[ds.data.year > _sage_const_1950 ]\
57
.pivot_table(\
58
values=["invest"],\
59
index=["firm"],\
60
columns=["year"])
61
except:
62
_st_.goboom(_sage_const_53 )
63
_st_.blockend()
64
try:
65
_st_.current_tex_line = _sage_const_61
66
_st_.inline(_sage_const_3 , pt.to_latex())
67
except:
68
_st_.goboom(_sage_const_61 )
69
_st_.endofdoc()
70
71