PYTHON4FINANCE Telegram 1065
خلاصه بندی OHLC داده ها با resample
یکی از توابع بسیار کاربردی pandas تابع resample است. به کمک این تابع می توانیم تناوب داده ها را تغییر دهیم. مثلا داده های ساعتی را به داده های روزانه تبدیل کنیم یا داده های روزانه را به هفتگی، ماهانه و سالانه.
یکی از بخش های قشنگ این ماژل تبدیل داده ها به فرمت OHLC است. یعنی داده های مربوط به بازشدن، بالاترین داده، کمترین داده و داده بسته شده. (البته برای بچه های بازار سرمایه این فرمت آشناست، اما برای سایر رشته ها شاید کمی عجیب به نظر برسد)
فرض کنید داده های ساعتی هواشناسی را داریم. می خواهیم دمای هوا در ابتدا و انتهای روز و نیز بالاترین دما و پایین ترین دما را مشخص و رسم کنیم.
با استفاده از resample به راحتی قابل انجام است.
import pandas as pd
import mplfinance as mpf
url="https://python4finance.ir/datafolder/WeatherData.csv"
df=pd.read_csv(url,index_col="Date/Time" , parse_dates=True)
mpf.plot(df.loc["01/01/2012 00:00":"05/01/2012 00:00"]["Temp_C"].resample("D").ohlc(),type="candle",figsize=(16,6),mav=(10))


#پانداس
#pandas
#resample

پایتون برای مالی

🆔 @python4finance



tgoop.com/python4finance/1065
Create:
Last Update:

خلاصه بندی OHLC داده ها با resample
یکی از توابع بسیار کاربردی pandas تابع resample است. به کمک این تابع می توانیم تناوب داده ها را تغییر دهیم. مثلا داده های ساعتی را به داده های روزانه تبدیل کنیم یا داده های روزانه را به هفتگی، ماهانه و سالانه.
یکی از بخش های قشنگ این ماژل تبدیل داده ها به فرمت OHLC است. یعنی داده های مربوط به بازشدن، بالاترین داده، کمترین داده و داده بسته شده. (البته برای بچه های بازار سرمایه این فرمت آشناست، اما برای سایر رشته ها شاید کمی عجیب به نظر برسد)
فرض کنید داده های ساعتی هواشناسی را داریم. می خواهیم دمای هوا در ابتدا و انتهای روز و نیز بالاترین دما و پایین ترین دما را مشخص و رسم کنیم.
با استفاده از resample به راحتی قابل انجام است.

import pandas as pd
import mplfinance as mpf
url="https://python4finance.ir/datafolder/WeatherData.csv"
df=pd.read_csv(url,index_col="Date/Time" , parse_dates=True)
mpf.plot(df.loc["01/01/2012 00:00":"05/01/2012 00:00"]["Temp_C"].resample("D").ohlc(),type="candle",figsize=(16,6),mav=(10))


#پانداس
#pandas
#resample

پایتون برای مالی

🆔 @python4finance

BY Python4Finance




Share with your friend now:
tgoop.com/python4finance/1065

View MORE
Open in Telegram


Telegram News

Date: |

bank east asia october 20 kowloon Matt Hussey, editorial director at NEAR Protocol also responded to this news with “#meIRL”. Just as you search “Bear Market Screaming” in Telegram, you will see a Pepe frog yelling as the group’s featured image. Matt Hussey, editorial director of NEAR Protocol (and former editor-in-chief of Decrypt) responded to the news of the Telegram group with “#meIRL.” Add the logo from your device. Adjust the visible area of your image. Congratulations! Now your Telegram channel has a face Click “Save”.! Telegram has announced a number of measures aiming to tackle the spread of disinformation through its platform in Brazil. These features are part of an agreement between the platform and the country's authorities ahead of the elections in October.
from us


Telegram Python4Finance
FROM American