Python Forum
NameError: name 'display' is not defined when running code on power bi
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NameError: name 'display' is not defined when running code on power bi
#1
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
Reply
#2
see: https://ipython.readthedocs.io/en/stable...splay.html
Reply
#3
Thanks for replies.

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm getting a NameError: ...not defined. vonArre 2 155 Mar-24-2024, 10:25 PM
Last Post: vonArre
  problem in running a code akbarza 7 543 Feb-14-2024, 02:57 PM
Last Post: snippsat
  Python Coding in Power BI Visual vjrans 0 232 Jan-31-2024, 07:54 AM
Last Post: vjrans
  Power Shells vs Compile and Run programs? RockBlok 2 318 Jan-13-2024, 09:08 PM
Last Post: RockBlok
  writing and running code in vscode without saving it akbarza 1 344 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  Variable is not defined error when trying to use my custom function code fnafgamer239 4 511 Nov-23-2023, 02:53 PM
Last Post: rob101
  the order of running code in a decorator function akbarza 2 479 Nov-10-2023, 08:09 AM
Last Post: akbarza
  Badly defined python code? Ken76 2 569 May-25-2023, 11:05 PM
Last Post: DigiGod
  How to display <IPython.core.display.HTML object>? pythopen 3 45,702 May-06-2023, 08:14 AM
Last Post: pramod08728
Question Python and Power BI Desktop dangermaus33 1 1,269 Jan-19-2023, 06:54 AM
Last Post: GetOnData

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020