from sage.all_cmdline import *
_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)
import sagetex
_st_ = sagetex.SageTeXProcessor('data', version='2015/08/26 v3.0-92d9f7a', version_check=True)
_st_.current_tex_line = _sage_const_11
_st_.blockbegin()
try:
t = r"""
\begin{tabular}{ll}
col1 & col2 \\
1 & 2 \\
3 & 4 via sagestr
\end{tabular}
"""
except:
_st_.goboom(_sage_const_19 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_24
_st_.inline(_sage_const_0 , "foo")
except:
_st_.goboom(_sage_const_24 )
try:
_st_.current_tex_line = _sage_const_26
_st_.inline(_sage_const_1 , t)
except:
_st_.goboom(_sage_const_26 )
_st_.current_tex_line = _sage_const_30
_st_.blockbegin()
try:
t2 = []
t2.append(r"\begin{tabular}{ll}")
t2.append(r"col1 & col2 \\")
t2.append(r"1 & 2 \\")
t2.append(r"3 & 4")
t2.append(r"\end{tabular}")
t2 = "\n".join(t2)
except:
_st_.goboom(_sage_const_38 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_40
_st_.inline(_sage_const_2 , t2)
except:
_st_.goboom(_sage_const_40 )
_st_.current_tex_line = _sage_const_44
_st_.blockbegin()
try:
import statsmodels.api as sm
import pandas as pd
ds = sm.datasets.grunfeld.load_pandas()
pt = ds.data[ds.data.year > _sage_const_1950 ]\
.pivot_table(\
values=["invest"],\
index=["firm"],\
columns=["year"])
except:
_st_.goboom(_sage_const_53 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_61
_st_.inline(_sage_const_3 , pt.to_latex())
except:
_st_.goboom(_sage_const_61 )
_st_.endofdoc()