Jupyter notebook 如何在Markdown cell Jupyter笔记本左侧显示表格
在两个代码单元格之间的标记单元格中有一个表格,它是自动居中的,我希望像文本一样位于单元格的左侧 代码如下:Jupyter notebook 如何在Markdown cell Jupyter笔记本左侧显示表格,jupyter-notebook,markdown,jupyter,Jupyter Notebook,Markdown,Jupyter,在两个代码单元格之间的标记单元格中有一个表格,它是自动居中的,我希望像文本一样位于单元格的左侧 代码如下: Let's use the first row of `indices` to classify the 0th flower in `X_test`. species | target --- | --- setosa | 0 versicolor | 1 virginica | 2 This cell prints the neighbor's po
Let's use the first row of `indices` to classify the 0th flower in `X_test`.
species | target
--- | ---
setosa | 0
versicolor | 1
virginica | 2
This cell prints the neighbor's position of closeness, index of the neighbor and that neighbor's `target` (Iris species).
您可以使用
Markdown
和display
来实现这些结果。以下是步骤:
from IPython.core.display import Markdown
m0 = Markdown('''
Let's use the first row of `indices` to classify the 0th flower in `X_test`.
''')
m1 = Markdown('''
|species | target |
|-----------|:------:|
|setosa | 0 |
|versicolor | 1 |
|virginica | 2 |
''')
m2 = Markdown('''
This cell prints the neighbor's position of closeness, index of the neighbor and that neighbor's `target` (Iris species).
''')
要显示,请执行此操作
display(m0,m1,m2)
这管用!有没有办法在一个降价单元格中完成这一切?