Python Forum

Full Version: NameError: name 'display' is not defined when running code on power bi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

New to python and have installed it.

looking to use it for some machine learning but to begin with trying to get it working.

can run below o. in juypter and have python installed to D:\python.

have installed pandas sand below works in juypter.

import pandas as pd

# create a simple dataset of people
data = {'Name': ["John", "Anna", "Peter", "Linda"],
        'Location' : ["New York", "Paris", "Berlin", "London"],
        'Age' : [24, 13, 53, 33]
       }

data_pandas = pd.DataFrame(data)
# IPython.display allows "pretty printing" of dataframes
# in the Jupyter notebook
display(data_pandas)
however when try run in power bi

get message below

Error:
Details: "ADO.NET: Python script error. Traceback (most recent call last): File "PythonScriptWrapper.PY", line 20, in <module> display(data_pandas) NameError: name 'display' is not defined
power bi also pointed to d:\python and it is also in PATH.

Anyone know how to resolve this and also and useful really simple python machine learning tutorials/example python code for supply chain/logistics delivery/vehicle maintenance predictions?

Thanks
Thanks for replies.

When leave out the display(data_pandas) works o.k . in power bi