Data Sampling with Python SQL Scripts
https://www.sqlshack.com/data-sampling-with-python-sql-scripts/
We can increase or decrease the frequency of data based on the time series and generate values for it with different methods. Suppose we have a monthly distribution of data for stock prices in share market. We want to generate samples at a weekly or daily basis. Similarly, if we have weekly data, we might wish to data resampling on a monthly or quarterly basis.
We can resample data in two ways:
-
Upsampling: We increase the date-time frequency in Upsampling. Example of Upsampling is as follows.
- Convert Yearly to Quarterly data
- Convert Quarterly to Monthly data
- Convert Monthly data into Weekly data
- Convert Weekly to Daily Convert
- Convert Daily to Hourly data
-
Downsampling: It is a reverse process to Upsampling. In this, we decrease the data-time frequency of data.
- Convert Hourly to Daily data
- Convert Daily to Weekly data
- Convert Weekly data to Monthly data
- Convert Monthly to Quarterly Convert
- Convert Quarterly to Yearly data
resample() .ffill()
https://www.jianshu.com/p/45955857d2a4