time-series

Getting wrong values after merging two dataframe on datetime

人走茶凉 提交于 2021-01-29 08:47:02
问题 I want to merge a time serie of % humidity with a range of datetime created as expected, to fill missing records (or rows) with NaN and obtain a time serie based on 15min records (as long as the sensor is designed for). Data of humidity following recorded datetime : humdt = pd.DataFrame(data = data["la-salade"][["datetime","humidite"]]) datetime humidite 0 2019-07-09 08:30:00 87 1 2019-07-09 11:00:00 87 2 2019-07-09 17:30:00 82 3 2019-07-09 23:30:00 80 4 2019-07-11 06:15:00 79 5 2019-07-19 14

LSTM Time series shifted predictions on stock market close price

痞子三分冷 提交于 2021-01-29 08:46:45
问题 I have developed a RNN system to predict the stock market close price based on several features. I removed the close price from the X and moved it to Y. I also made a shift on Y and dropna() to make sure that all features of day X(t) is equals to Y(t+future_days). Thus means that the features for today will predict the close price of today plus future_days. From the images bellow, the first future_days = 20 and the second future_days = 5. The prediction is shifted the number of future_days in

Time series animation in Matlab

吃可爱长大的小学妹 提交于 2021-01-29 08:34:39
问题 I am new to working with time series in Matlab and am struggling with getting this going. I have time series heat-transfer data (over a period of 20ms in steps of 1 microsecond) at these 11 locations (see code below). I am clueless as to how I could put them together to be able to generate a plot at each time step and use getframe at each timestep to make an animation. Any help on how to get started with this would be much appreciated. Here is a link to the 11 data files, providing time on

Pandas DatetimeIndex: Number of periods in a frequency string?

回眸只為那壹抹淺笑 提交于 2021-01-29 08:24:41
问题 How can I get a count of the number of periods in a Pandas DatetimeIndex using a frequency string (offset alias)? For example, let's say I have the following DatetimeIndex: idx = pd.date_range("2019-03-01", periods=10000, freq='5T') I would like to know how many 5 minute periods are in a week, or '7D'. I can calculate this "manually": periods = (7*24*60)//5 Or I can get the length of a dummy index: len(pd.timedelta_range(start='1 day', end='8 days', freq='5T')) Neither approach seems very

Getting null results from the accuracy function in fabletools package

旧街凉风 提交于 2021-01-29 06:05:32
问题 I have a time series that looks like this t value 1 12 2 12 3 0 4 0 5 0 6 0 7 0 I expect acf1 to equal 0.443, but instead the accuracy function produces null. The code is as following: df = data.frame("t" = 1:7, "value" = c(12, 12, 0, 0, 0, 0, 0)) tsb = df %>% as_tsibble(index = t) md = tsb %>% model(arima = ARIMA(value ~ PDQ(period = 4), stepwise = F)) fc = md %>% forecast(h = 4) accuracy(fc, tsb) Why is this happening? 回答1: The ACF1 column from accuracy() is the first auto-correlation of

Creating datetime in pandas from year and julian day

随声附和 提交于 2021-01-29 04:19:57
问题 ad_name adl_name year JD 0 united_states_of_america colorado 2000 1 1 united_states_of_america colorado 2000 2 2 united_states_of_america colorado 2000 3 3 united_states_of_america colorado 2000 4 4 united_states_of_america colorado 2000 5 how do I add a datetime column using the year and JD (julian day) columns? I was trying to use: pd.to_datetime(df, format='%Y_%d') , but that does not work 回答1: You need add to year column JD converted to_timedelta: df['date'] = pd.to_datetime(df.year,

Applying Time series models for each row

非 Y 不嫁゛ 提交于 2021-01-29 03:17:08
问题 I have a dataframe (df), which is wide dataset with the following structure, ID 2015/01/01 2015/02/01 2015/03/01 2015/04/01 A1 42 42 24 32 A2 22 22 24 32 A3 12 15 19 22 A4 8 12 18 24 I want to build time series model for each row, thus there will be N time series model where N = number of rows in dataframe I tired the following: ts_1 <- ts(df[1:1,], start = c(2015, 05), frequency = 12) ts_1_stl <- stl(ts_1, s.window = "periodic") But I got the error as : Error in stl(ts_1, s.window =

R / Time Series: What's the lag unit for autocorrelation function (acf)?

…衆ロ難τιáo~ 提交于 2021-01-28 23:09:02
问题 I have an XTS time series object which shows a value on the first of each month (representing an aggregated sum for the whole month) during four years. When I run the stats::acf() function on it, I get a plot with lag (x axis) units in the hundreds of thousands. How can that be if I only have 48 values in my time series? If it is a time unit, then which one, and how can I change it? Example code: library(dplyr) library(lubridate) library(xts) set.seed(100) test <- data.frame(y = c(rep(2012,

R / Time Series: What's the lag unit for autocorrelation function (acf)?

非 Y 不嫁゛ 提交于 2021-01-28 22:50:49
问题 I have an XTS time series object which shows a value on the first of each month (representing an aggregated sum for the whole month) during four years. When I run the stats::acf() function on it, I get a plot with lag (x axis) units in the hundreds of thousands. How can that be if I only have 48 values in my time series? If it is a time unit, then which one, and how can I change it? Example code: library(dplyr) library(lubridate) library(xts) set.seed(100) test <- data.frame(y = c(rep(2012,

Get apps with the highest review count since a dynamic series of days

三世轮回 提交于 2021-01-28 21:41:12
问题 I have two tables, apps and reviews (simplified for the sake of discussion): apps table id int reviews table id int review_date date app_id int (foreign key that points to apps) 2 questions: 1. How can I write a query / function to answer the following question?: Given a series of dates from the earliest reviews.review_date to the latest reviews.review_date (incrementing by a day), for each date, D , which apps had the most reviews if the app's earliest review was on or later than D ? I think