我有一个自定义模板,用于从我的 Jupyter 笔记本导出到 LaTeX。
((*- extends 'article.tplx' -*))
% Disable input cells
((* block input_group *))
((* endblock input_group *))
这工作正常,但有时笔记本中的 Python 代码会产生警告和错误,这些警告和错误对笔记本有帮助,但在导出中没有帮助。例如,在一个笔记本中有这个块:
{
"cell_type": "code",
"execution_count": 106,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\me\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:3: FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame) but in a future version of pandas this will be changed to expand=True (return DataFrame)\n",
" This is separate from the ipykernel package so we can avoid doing imports until\n"
]
}
],
"source": [
"# Some Python code using Pandas\n",
"df = d.join(df.mycol.str.extract((?P<foo>\\d)')\n",
")"
]
}
我想在导出时排除此类错误。我尝试将以下行添加到我的模板中:
% Hide Stderr output
((* block stream_stderr *))
((* endblock stream_stderr *))
但是,我仍然在 LaTeX 输出中看到相应的错误。我究竟做错了什么?