- I have below scripts with python
import pandas as pd import chart_studio.plotly as py import plotly.graph_objects as go labelListTemp1 = list(set(dataset.source.values)) labelListTemp2 = list(set(dataset.target.values)) labelList = labelListTemp1 + labelListTemp2 sankey_node = list(dict.fromkeys(labelList)) fig = go.Figure(data=[go.Sankey( node = dict( pad=15, thickness=20, line = dict(color = "black", width = 0.5), label = labelList, color = "blue" ), link = dict(source = dataset.source.apply(lambda x: labelList.index(x)), target = dataset.target.apply(lambda x: labelList.index(x)), value = dataset.value))]) fig.show()
Then I enable python visual in powerBI, and then drag-and-drop source, target and value into 'Values' section.
Then I run the python script in step1
But the sankey chart doesn't displayed in powerBI. the code open a browser and display the sankey chart in the browser, which is not what I want. please refer to below screenshot.
[![enter image description here][1]][1]
Expected result: I want the sankey chart displayed inside powerBI, so I can publish the chart and send it to team members.
Any expert please help take a look what's wrong with my code?
Thanks, Cherie