从函数调用 DataFrame .head() 时不起作用

Cod*_*van 2 python ipython dataframe pandas jupyter-notebook

在 Jupyter 的 Notebook 中调用此函数时,它不打印任何内容:

def printess(request):
        table_AltModels[request].head(10)
Run Code Online (Sandbox Code Playgroud)

在此代码中,table_AltModels[request] 是有效的数据帧。

我希望我的函数在表格中显示数据框,如下所示

谢谢

Pin*_*ntu 7

使用退货或打印

return table_AltModels[request].head(10)
Run Code Online (Sandbox Code Playgroud)

或者

print table_AltModels[request].head(10)  
Run Code Online (Sandbox Code Playgroud)

或者

from IPython.display import display
display(table_AltModels[request].head(10))
Run Code Online (Sandbox Code Playgroud)