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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Power BI report view as viewer error : Python Script Runtime Error TypeError (app.powerbi.com)

Dear Power BI support team and experts,

 

I have a dashboard page that shows a custom line chart from Power BI python scripts. Everything works as intended on Power BI desktop.

 

However, every time I tried to view that report page on app.powerbi.com, I get the following error.

zawlynn_0-1624847726065.png

 

Here is my python script.

FYI, my dataframe "dataset" has no float or decimals, all int.

 

My dataframe, 

zawlynn_1-1624847725700.png

 

 

 

import matplotlib.pyplot as plt 
import pandas as pd
import seaborn as sns
import math


fig, ax = plt.subplots()
sns.lineplot(ax=ax, data = dataset, x='Year_month', y='Budget', hue='office', legend=None)
sns.lineplot(ax=ax, data = dataset, x='Year_month', y='Actual', hue='office', legend=None, linestyle='--')
cust_anno = ['line1','line2','line3','line4','line5','line6','line7','line8','line9','line10','line11','line12']

for line, name in zip(ax.lines, cust_anno)
y = line.get_ydata()
x = line.get_xdata()
if len(y)>0:
ax.annotate(name, xy=(x[-1],y[-1]), xycoords=(ax.get_xaxis_transform(), ax.get_yaxis_transform()), ha="left", va='center', color=line.get_color())
print(ax.get_xaxis_transform())

plt.xticks(dataset.Year_month, dataset.Year_month, rotation=45, ha='right')
plt.tight_layout(pad=0, w_pad=0, h_pad=0)
plt.show()

and Here is my Power BI desktop showing line chart generated by Python as intended.

zawlynn_2-1624847725877.png

 

 

Thank you very much for your time and helps in advance.

 

Status: New
Comments
v-chuncz-msft
Community Support

@zawlynn 

 

The data type for ticks is not appropriate.