Telegram Group & Telegram Channel
This media is not supported in your browser
VIEW IN TELEGRAM
رسم نمودارهای تعاملی با plotly
یکی از ماژول های عالی برای رسم نمودارهای تعاملی ماژول plotly است. با استفاده از این ماژول می توان نمودارهای متنوعی را به راحتی ترسیم کرد. مثلا می خواهید قیمت های روزانه یک سهم را در یک بازه طولانی در یک نمودار تعاملی نشان دهید.
ابتدا ماژولهای مورد نیاز را ایمپورت می کنیم:
import yfinance as yf
import plotly.express as px
import pandas as pd

در گام بعد اطلاعات سهم را برای یک بازه 3 ساله دریافت می‌کنیم:
msft = yf.Ticker("MSFT")
msft_hist = msft.history(period="3y")

حالا داده های روز و ماه و سال را دریافت می کنیم:
msft_hist['Date'] = msft_hist.index.date
msft_hist['Year'] = msft_hist.index.year
msft_hist['Month'] = msft_hist.index.month_name()
msft_hist['Day'] = msft_hist.index.day

حالا نوبت رسم داده هاست. با یک نمودار sunburst کار را تمام می کنیم:
fig = px.sunburst(msft_hist, path=['Year', 'Month', 'Day'], values='Close',
title='Microsoft Stock Closing Prices Sunburst Chart Over the Last Year' , height=700)
fig.show()



پایتون برای مالی
🆔 www.tg-me.com/us/Python4Finance/com.python4finance



tg-me.com/python4finance/1040
Create:
Last Update:

رسم نمودارهای تعاملی با plotly
یکی از ماژول های عالی برای رسم نمودارهای تعاملی ماژول plotly است. با استفاده از این ماژول می توان نمودارهای متنوعی را به راحتی ترسیم کرد. مثلا می خواهید قیمت های روزانه یک سهم را در یک بازه طولانی در یک نمودار تعاملی نشان دهید.
ابتدا ماژولهای مورد نیاز را ایمپورت می کنیم:

import yfinance as yf
import plotly.express as px
import pandas as pd

در گام بعد اطلاعات سهم را برای یک بازه 3 ساله دریافت می‌کنیم:
msft = yf.Ticker("MSFT")
msft_hist = msft.history(period="3y")

حالا داده های روز و ماه و سال را دریافت می کنیم:
msft_hist['Date'] = msft_hist.index.date
msft_hist['Year'] = msft_hist.index.year
msft_hist['Month'] = msft_hist.index.month_name()
msft_hist['Day'] = msft_hist.index.day

حالا نوبت رسم داده هاست. با یک نمودار sunburst کار را تمام می کنیم:
fig = px.sunburst(msft_hist, path=['Year', 'Month', 'Day'], values='Close',
title='Microsoft Stock Closing Prices Sunburst Chart Over the Last Year' , height=700)
fig.show()



پایتون برای مالی
🆔 www.tg-me.com/us/Python4Finance/com.python4finance

BY Python4Finance


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python4finance/1040

View MORE
Open in Telegram


Python4Finance Telegram | DID YOU KNOW?

Date: |

Telegram announces Search Filters

With the help of the Search Filters option, users can now filter search results by type. They can do that by using the new tabs: Media, Links, Files and others. Searches can be done based on the particular time period like by typing in the date or even “Yesterday”. If users type in the name of a person, group, channel or bot, an extra filter will be applied to the searches.

What is Secret Chats of Telegram

Secret Chats are one of the service’s additional security features; it allows messages to be sent with client-to-client encryption. This setup means that, unlike regular messages, these secret messages can only be accessed from the device’s that initiated and accepted the chat. Additionally, Telegram notes that secret chats leave no trace on the company’s services and offer a self-destruct timer.

Python4Finance from us


Telegram Python4Finance
FROM USA