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
  Wish to write a code for an electronic load and a power supply for measuring Eff Hasan2025 2 377 Apr-28-2025, 07:12 AM
Last Post: Hasan2025
  code not running even without errors Azdaghost 2 361 Apr-25-2025, 07:35 PM
Last Post: Azdaghost
  python code not running Azdaghost 1 271 Apr-22-2025, 08:44 PM
Last Post: deanhystad
  writing and running code in vscode without saving it akbarza 5 2,542 Mar-03-2025, 08:14 PM
Last Post: Gribouillis
  NameError: name 'pi' is not defined katebishop 2 2,703 Jul-15-2024, 05:48 AM
Last Post: Pedroski55
  cheap and low power python device kucingkembar 6 1,594 Jun-27-2024, 12:41 PM
Last Post: kucingkembar
  I'm getting a NameError: ...not defined. vonArre 2 5,339 Mar-24-2024, 10:25 PM
Last Post: vonArre
  problem in running a code akbarza 7 2,417 Feb-14-2024, 02:57 PM
Last Post: snippsat
  Python Coding in Power BI Visual vjrans 0 823 Jan-31-2024, 07:54 AM
Last Post: vjrans
  Power Shells vs Compile and Run programs? RockBlok 2 1,194 Jan-13-2024, 09:08 PM
Last Post: RockBlok

Forum Jump:

User Panel Messages

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