Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Can't run any Python script in Power BI Desktop

Hello everyone,

 

i installed python to implement a visualization with python to power bi.

 

My visualization ist the following code.

I paste this in the script editor in power bi to show the visual in power bi but i always get a error message but i dont know why.

 

In juypter the code is working.

 

import matplotlib.pyplot as plt
import numpy as np

width = 0.8

highPower = [1184.53,1523.48,1521.05,1517.88,1519.88]
lowPower = [1000.95,1233.37, 1198.97,1198.01,1214.29]
medium = [800,805,803,790,795]
medium2 = [500,502,503,504,540]

indices = np.arange(len(highPower))

plt.bar(indices, highPower, width=width,
color='b', label='Max Power in mW')

plt.bar([i+0.3*width for i in indices], lowPower,
color='r', alpha=1, label='Min Power in mW')

plt.bar([i+0.6*width for i in indices], medium,
color='g', alpha=1, label='Med Power in mW')

plt.bar([i+0.9*width for i in indices], medium2,
color='y', alpha=1, label='Min Power in mW')

plt.xticks(indices+width/8,
['T{}'.format(i) for i in range(len(highPower))] )

 

plt.show()

 

Thank you for your help in advance.

 

Best regards

5 Replies