<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python script for Power BI Desktop visualization does not work in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-for-Power-BI-Desktop-visualization-does-not-work/m-p/3266718#M53687</link>
    <description>&lt;P&gt;Hello, everyone!&lt;/P&gt;&lt;P&gt;Now I am studying Python and as I previously worked with Power BI, I tried to test how it would be to run Python vizualization script in Power BI Desktop.&lt;/P&gt;&lt;P&gt;The script I tried to run is written using Python plotly library and works perfect on Jupyter and there is nothing special about it:&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;import matplotlib.pyplot as plt&lt;/P&gt;&lt;P&gt;import plotly.express as px&lt;/P&gt;&lt;P&gt;import plotly.graph_objects as go&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;df = pd.read_csv('C:\\path.csv');&lt;/P&gt;&lt;P&gt;df['open_time_timeformat'] = pd.to_datetime(df['open_time'], unit='ms').dt.strftime('%Y-%m-%d %H:%M:%S')&lt;/P&gt;&lt;P&gt;df['close_time_timeformat'] = pd.to_datetime(df['close_time'], unit='ms').dt.strftime('%Y-%m-%d %H:%M:%S')&lt;/P&gt;&lt;P&gt;df['day'] = pd.to_datetime(df['close_time'], unit='ms').dt.strftime('%d')&lt;/P&gt;&lt;P&gt;df['difference']= df['quote_volume'] - df['taker_buy_quote_volume']&lt;/P&gt;&lt;P&gt;fig = go.Figure(data=[go.Candlestick(x=df['close_time_timeformat'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; open=df['open'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; high=df['high'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; low=df['low'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; close=df['close'])])&lt;/P&gt;&lt;P&gt;fig.update_layout(hovermode='x unified', autosize = True, title={&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'text': "High, low, open and close prices of BTCUSDT",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'y':0.85,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'x':0.5,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'xanchor': 'center',&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'yanchor': 'top'})&lt;/P&gt;&lt;P&gt;fig.update_layout(hoverlabel=dict(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bgcolor="white",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font_size=22,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font_family="Rockwell"))&lt;/P&gt;&lt;P&gt;fig.update_yaxes(type="log")&lt;/P&gt;&lt;P&gt;fig.show()&lt;/P&gt;&lt;P&gt;The problem is that after running it in Power BI Desktop Python script editor, it:&lt;/P&gt;&lt;P&gt;1)Does not show visual on PBI –shows error “can’t display visual”&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Arvins_0-1685803304367.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/923846i53A7AB784B7686F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Arvins_0-1685803304367.png" alt="Arvins_0-1685803304367.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2)Internet browser starts trying to open URL page, showing “this site can’t be reached” and few times it even succeeds to open visualization (and shows as perfect as on Jupyter)!!!, which completely is not a purpose of this and script does not provide to do it!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise what would is a problem and is it necessary to do extra manipulations in PBI Desktop for Python script to be working properly?&lt;/P&gt;&lt;P&gt;p.s. I have all necessary Python modules installed and paths are correct in PBI Python scripting options – otherwise it would not be possible to load script into PBI Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Sat, 03 Jun 2023 14:44:41 GMT</pubDate>
    <dc:creator>Arvins</dc:creator>
    <dc:date>2023-06-03T14:44:41Z</dc:date>
    <item>
      <title>Python script for Power BI Desktop visualization does not work</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-for-Power-BI-Desktop-visualization-does-not-work/m-p/3266718#M53687</link>
      <description>&lt;P&gt;Hello, everyone!&lt;/P&gt;&lt;P&gt;Now I am studying Python and as I previously worked with Power BI, I tried to test how it would be to run Python vizualization script in Power BI Desktop.&lt;/P&gt;&lt;P&gt;The script I tried to run is written using Python plotly library and works perfect on Jupyter and there is nothing special about it:&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;import matplotlib.pyplot as plt&lt;/P&gt;&lt;P&gt;import plotly.express as px&lt;/P&gt;&lt;P&gt;import plotly.graph_objects as go&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;df = pd.read_csv('C:\\path.csv');&lt;/P&gt;&lt;P&gt;df['open_time_timeformat'] = pd.to_datetime(df['open_time'], unit='ms').dt.strftime('%Y-%m-%d %H:%M:%S')&lt;/P&gt;&lt;P&gt;df['close_time_timeformat'] = pd.to_datetime(df['close_time'], unit='ms').dt.strftime('%Y-%m-%d %H:%M:%S')&lt;/P&gt;&lt;P&gt;df['day'] = pd.to_datetime(df['close_time'], unit='ms').dt.strftime('%d')&lt;/P&gt;&lt;P&gt;df['difference']= df['quote_volume'] - df['taker_buy_quote_volume']&lt;/P&gt;&lt;P&gt;fig = go.Figure(data=[go.Candlestick(x=df['close_time_timeformat'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; open=df['open'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; high=df['high'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; low=df['low'],&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; close=df['close'])])&lt;/P&gt;&lt;P&gt;fig.update_layout(hovermode='x unified', autosize = True, title={&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'text': "High, low, open and close prices of BTCUSDT",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'y':0.85,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'x':0.5,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'xanchor': 'center',&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'yanchor': 'top'})&lt;/P&gt;&lt;P&gt;fig.update_layout(hoverlabel=dict(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bgcolor="white",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font_size=22,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font_family="Rockwell"))&lt;/P&gt;&lt;P&gt;fig.update_yaxes(type="log")&lt;/P&gt;&lt;P&gt;fig.show()&lt;/P&gt;&lt;P&gt;The problem is that after running it in Power BI Desktop Python script editor, it:&lt;/P&gt;&lt;P&gt;1)Does not show visual on PBI –shows error “can’t display visual”&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Arvins_0-1685803304367.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/923846i53A7AB784B7686F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Arvins_0-1685803304367.png" alt="Arvins_0-1685803304367.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2)Internet browser starts trying to open URL page, showing “this site can’t be reached” and few times it even succeeds to open visualization (and shows as perfect as on Jupyter)!!!, which completely is not a purpose of this and script does not provide to do it!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise what would is a problem and is it necessary to do extra manipulations in PBI Desktop for Python script to be working properly?&lt;/P&gt;&lt;P&gt;p.s. I have all necessary Python modules installed and paths are correct in PBI Python scripting options – otherwise it would not be possible to load script into PBI Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jun 2023 14:44:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-script-for-Power-BI-Desktop-visualization-does-not-work/m-p/3266718#M53687</guid>
      <dc:creator>Arvins</dc:creator>
      <dc:date>2023-06-03T14:44:41Z</dc:date>
    </item>
  </channel>
</rss>

