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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
victoriavd
Frequent Visitor

Python visuals plotting graph_objects

Hi everyone,

 

I need help with python visuals. The following  script works fine in jupiter notebook, but I face an issue when passing it to PBI Ithe plotting part). It plots (displays a picture) in a separate HTML page rather than in the framework itself.

 

Any idea on how to get the picture in the PBI page ?

 

Thanks in advance.  V.

 

import pandas as pd
from pandas_datareader import data
import pandas_datareader as pdr
import datetime as dt
import seaborn as sns
from dateutil.relativedelta import relativedelta
import pandas_datareader.data as web
import plotly.graph_objects as go
import pandas_datareader.data as web

# getting yahoo data
end = dt.date.today()
start = end - relativedelta(months=3)

df = web.DataReader('AAPL','yahoo',start,end)
df.reset_index(inplace=True)

# polotting it
fig = go.Figure(data=[go.Candlestick(x=df['Date'],
open=df['Open'],
high=df['High'],
low=df['Low'],
close=df['Close'], increasing_line_color= 'cyan', increasing_line_width = 1,decreasing_line_color= 'gray')])
fig.update_layout(title_text='AAPL STOCKS',
title_font_size=20, title_font_color = 'red',
yaxis_title='USD' , yaxis_title_font_color ='black', xaxis_title=' DATE', plot_bgcolor='azure')
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='grey')
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='grey')

fig.show()

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@victoriavd 

 

You may check if the post below helps.

https://community.powerbi.com/t5/Desktop/how-to-download-daily-stock-prices-in-a-calculated-table/m-...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thanks for the reply, not quite….. I do not have a problem downloading the data with Python, and even visualizing goes well – the only problem is that it displays it in the separate HTML page rather than the PBI page itself.

V.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.