我有一个可以用以下代码重建的表
results = [(4.898, 6.345, 0.0564),
(5.000, 6.250, 0.0637)]
df = pd.DataFrame(results,
columns=["$mu$","$\sigma^2$","$\widetilde{\mu_3}$"],
index=["$w_1$","$w_2$"])
当我将它导出 df.to_latex("myDirectory/myTable.tex")并读入乳胶\input{./myDirectory/myTable}时,结果表看起来像
\begin{tabular}{lrrr}
\toprule
{} & \$mu\$ & \$\textbackslash sigma\textasciicircum 2\$ & \$\textbackslash widetilde\{\textbackslash mu\_3\}\$ \\
\midrule
\$w\_1\$ & 4.899 & 6.345 & 0.056 \\
\$w\_2\$ & 5.000 & 6.250 & 0.064 \\
\bottomrule
\end{tabular}
当它正确渲染时,它应该
\begin{tabular}{lrrr}
\toprule
{} & $\mu$ & $ \sigma^2$ & $\widetilde{\mu_3}$ \\
\midrule
$w_1$ & 4.899 & 6.345 & 0.056 \\
$w_2$ & 5.000 & 6.250 & 0.064 \\
\bottomrule
\end{tabular}
是否有一个简单的解决方法或者 Pandas 不支持这个?