Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Python error

I use python visual but I use script as below , Ii error.

 

adamasmay_1-1616060159325.png

 


import numpy as np
import matplotlib.pyplot as plt
dataset = pandas.DataFrame(% Developing(In month), % Developing(Last Month), code and name process)
y = dataset.code and name process
x1 = dataset.% Developing(Last Month)
x2 = dataset.% Developing(In month)

 

b=plt.barh(y, x1,align="center",color="#66c2a5",label="% Developing(Last Month)")
b2=plt.barh(y, x2,align="center",left=x1,color="#8da0cb",label="% Developing(In month)")

for rect in b:
w = rect.get_width()
plt.text(w-0.05, rect.get_y()+rect.get_height()/2, '{:.0%}'.format(w), ha='left', va='center',fontsize=20)
plt.xticks([0.05, 0.5,0.9, 1],['$on process$', '$continue$', '$On the way$','$Completed$'])
plt.grid(axis="x", which="major",linestyle='-.')
plt.title('custom')
plt.xlabel('xlabel name')
plt.ylabel('ylabel name')
plt.legend()
plt.show()

 

Guide me about it please.

 

4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @Anonymous 

What are the other bits in the DataFrame call : and name process ?

The structure of the call to DataFrame doesn't match the documentation.

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

@PhilipTreacy  When I choose value  , PBI  create script as below.

 

Capture.JPG

adamasmay_3-1616062935773.png

 

PhilipTreacy
Super User
Super User

Hi @Anonymous 

Your call to pandas.DataFrame doesn't look right

pandas.DataFrame(% Developing(In month), % Developing(Last Month), code and name process)

Refer to pandas.DataFrame — pandas 1.2.3 documentation (pydata.org)

 

What is code and name process? It looks like you are trying to pass multiple arguments but I suspect that's not actually what you intend.

What is % Developing(Last Month) meant to be?  The index?

Did you test this script in Python outside PBI?

Although PBI allows spaces and special chars like % in names, it's best to avoid using them when you have to deal with other environments.

Regards

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

@PhilipTreacy My value as below.

 

adamasmay_0-1616061183277.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.