Codevan
Codevan

Reputation: 558

DataFrame .head() doesn't work when calling it from a function

When calling this function in Jupyter's Notebook, it prints nothing:

def printess(request):
        table_AltModels[request].head(10)

where in this code table_AltModels[request] is a valid dataframe.

I would like my function to show the dataframe in a table like here: table

Thanks

Upvotes: 2

Views: 2035

Answers (1)

Pintu
Pintu

Reputation: 308

Either use a return or a print

return table_AltModels[request].head(10)

or

print table_AltModels[request].head(10)  

or

from IPython.display import display
display(table_AltModels[request].head(10))

Upvotes: 7

Related Questions