天天看點

Jupyter顯示整個cell的輸出以及如何顯示輸出結果的所有行和列

Jupyter顯示整個cell的輸出,而不需print()

Jupyter輸出不用print()真是非常友善,但是通常情況隻會輸出最後一個結果。如果想要輸出一段代碼的很多中間值,同時不使用print()呢?

在jupyter裡加入:

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
           

舉個簡單例子:

Jupyter顯示整個cell的輸出以及如何顯示輸出結果的所有行和列
Jupyter顯示整個cell的輸出以及如何顯示輸出結果的所有行和列

Jupyter顯示輸出結果的所有行和列

pd.options.display.max_columns = None
pd.options.display.max_rows = None