<?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 Cannot plot the Plotly visual using Python in PBI desktop in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4024547#M53920</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise how to resolve this error? My Python script works fine in Databrics, however, when I run it in Power BI it opens up the visual in the browser window instead and gives me this error:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WOLFIE_0-1720080456937.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1126693i0529BB6CDA7B8B1D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WOLFIE_0-1720080456937.png" alt="WOLFIE_0-1720080456937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
import plotly.express as px

# Create a DataFrame
dataset = pd.DataFrame(dataset)

# Convert 'End Date' and 'Start Date' to datetime objects
dataset['End Date'] = pd.to_datetime(dataset['End Date'])
dataset['Start Date'] = pd.to_datetime(dataset['Start Date'])

# Calculate the difference in days between 'End Date' and 'Start Date'
dataset['diff'] = (dataset['End Date'] - dataset['Start Date']).dt.days

# Reverse the DataFrame to match the reversed y-axis labels
dataset = dataset.iloc[::-1].reset_index(drop=True)

# Create a figure and axis
fig = px.timeline(dataset, x_start="Start Date", x_end="End Date", y="Event Description", color="Group Name",
                  hover_data={"Start Date": "|%Y-%m-%d", "End Date": "|%Y-%m-%d"},
                  labels={"Start Date": "Start Date", "End Date": "End Date"})

# Update layout
fig.update_layout(
    title='Timeline',
    xaxis=dict(
        title='Date',
        tickformat='%Y'
    ),
    yaxis=dict(
        title='Group Name'
    )
)

# Show the figure
fig.show()&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 04 Jul 2024 08:10:54 GMT</pubDate>
    <dc:creator>WOLFIE</dc:creator>
    <dc:date>2024-07-04T08:10:54Z</dc:date>
    <item>
      <title>Cannot plot the Plotly visual using Python in PBI desktop</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4024547#M53920</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise how to resolve this error? My Python script works fine in Databrics, however, when I run it in Power BI it opens up the visual in the browser window instead and gives me this error:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WOLFIE_0-1720080456937.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1126693i0529BB6CDA7B8B1D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WOLFIE_0-1720080456937.png" alt="WOLFIE_0-1720080456937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
import plotly.express as px

# Create a DataFrame
dataset = pd.DataFrame(dataset)

# Convert 'End Date' and 'Start Date' to datetime objects
dataset['End Date'] = pd.to_datetime(dataset['End Date'])
dataset['Start Date'] = pd.to_datetime(dataset['Start Date'])

# Calculate the difference in days between 'End Date' and 'Start Date'
dataset['diff'] = (dataset['End Date'] - dataset['Start Date']).dt.days

# Reverse the DataFrame to match the reversed y-axis labels
dataset = dataset.iloc[::-1].reset_index(drop=True)

# Create a figure and axis
fig = px.timeline(dataset, x_start="Start Date", x_end="End Date", y="Event Description", color="Group Name",
                  hover_data={"Start Date": "|%Y-%m-%d", "End Date": "|%Y-%m-%d"},
                  labels={"Start Date": "Start Date", "End Date": "End Date"})

# Update layout
fig.update_layout(
    title='Timeline',
    xaxis=dict(
        title='Date',
        tickformat='%Y'
    ),
    yaxis=dict(
        title='Group Name'
    )
)

# Show the figure
fig.show()&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Jul 2024 08:10:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4024547#M53920</guid>
      <dc:creator>WOLFIE</dc:creator>
      <dc:date>2024-07-04T08:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot plot the Plotly visual using Python in PBI desktop</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4025830#M53936</link>
      <description>&lt;P&gt;You cannot bring your own renderer, you need to use the default renderer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-visuals" target="_blank"&gt;Create Power BI visuals using Python in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 00:38:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4025830#M53936</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-07-05T00:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot plot the Plotly visual using Python in PBI desktop</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4026390#M53948</link>
      <description>&lt;P&gt;This is annoying as Plotly is the only option that provides interactive visual &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; Thanks for your response.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 06:32:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4026390#M53948</guid>
      <dc:creator>WOLFIE</dc:creator>
      <dc:date>2024-07-05T06:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot plot the Plotly visual using Python in PBI desktop</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4027564#M53966</link>
      <description>&lt;P&gt;If this is important to you please consider voting for an existing idea or raising a new one at &lt;A href="https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41" target="_blank"&gt;https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 19:13:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-plot-the-Plotly-visual-using-Python-in-PBI-desktop/m-p/4027564#M53966</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-07-05T19:13:24Z</dc:date>
    </item>
  </channel>
</rss>

