time-series

Create lag / lead time series with by groups in Julia?

喜夏-厌秋 提交于 2021-01-02 18:12:23
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Create lag / lead time series with by groups in Julia?

南笙酒味 提交于 2021-01-02 18:11:29
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Creating interaction sessions based on timestamps in pandas

≡放荡痞女 提交于 2020-12-31 05:05:55
问题 I am trying to define which apps were used in different mobile usage sessions. Basically, a session is a series of actions by a single user made within a small range of time (aka. session delta). In other words, if no interaction happens within 5 minutes of the previous interaction, a user’s session is deemed closed. The next interaction is considered a separate session. I would like to know how many mobile sessions are there in the dataset. Also, I would like to know which apps were launched

Clustering similar time series?

ⅰ亾dé卋堺 提交于 2020-12-30 08:14:23
问题 I have somewhere between 10-20k different time-series (24 dimensional data -- a column for each hour of the day) and I'm interested in clustering time series that exhibit roughly the same patterns of activity. I had originally started to implement Dynamic Time Warping (DTW) because: Not all of my time series are perfectly aligned Two slightly shifted time series for my purposes should be considered similar Two time series with the same shape but different scales should be considered similar

R: expand sequence of binary values from a time column

爷,独闯天下 提交于 2020-12-23 12:08:51
问题 I have a table of time and binary values, > head(x,10) Time binary 1 358.214 1 2 359.240 1 3 360.039 0 4 361.163 0 5 361.164 1 6 362.113 1 7 362.114 0 8 365.038 0 9 365.039 0 10 367.488 0 I want to check after a second wether the value in binary column is 1 or 0, and then create new column of the new values. The time here is not continues. For example, first value here is (358.214) and the binary value is 1, if I add a second it is going to be (359.214) and the value is still 1 based on the

Difficulty Plotting Time Series in R

半腔热情 提交于 2020-12-15 05:40:50
问题 I have been trying to plot time series data in R. I consulted several different sources online and somehow I am still having problems creating this plots. I have simulated some data below that represents daily information a fictitious company received from 2014 to 2016: #create data date_decision_made = seq(as.Date("2014/1/1"), as.Date("2016/1/1"),by="day") date_decision_made <- format(as.Date(date_decision_made), "%Y/%m/%d") property_damages_in_dollars <- rnorm(731,100,10) car_damages_in

Gap size calculation in time series with R

五迷三道 提交于 2020-12-13 04:55:44
问题 Let's say I have a dataframe with contains time series as below: Date value 2000-01-01 00:00:00 4.6 2000-01-01 01:00:00 N/A 2000-01-01 02:00:00 5.3 2000-01-01 03:00:00 6.0 2000-01-01 04:00:00 N/A 2000-01-01 05:00:00 N/A 2000-01-01 06:00:00 N/A 2000-01-01 07:00:00 6.0 I want to find an efficient way to calculate the size of the gap (number of consecutive N/As) and add it to a new column of my dataframe to get the following: Date value gap_size 2000-01-01 00:00:00 4.6 0 2000-01-01 01:00:00 N/A

Is Redis TimeSeries the right tool to capture candle sticks in stock prices

断了今生、忘了曾经 提交于 2020-12-13 03:42:44
问题 I am currently trying to do a simple implementation for stock price candle sticks. Let's say we have a stock called XYZ. This stock receives a stream of prices (in no particular frequency), which (for example) looks like: XYZ: [10.2, 10.7, 12, 11 ....]. The objective is to record some metrics for every minute that passes to reflect the state of that stock. A candle stick has metrics like Closing price (last known price within a minute), High Price (maximum price within a minute)...etc. One

Is Redis TimeSeries the right tool to capture candle sticks in stock prices

主宰稳场 提交于 2020-12-13 03:37:49
问题 I am currently trying to do a simple implementation for stock price candle sticks. Let's say we have a stock called XYZ. This stock receives a stream of prices (in no particular frequency), which (for example) looks like: XYZ: [10.2, 10.7, 12, 11 ....]. The objective is to record some metrics for every minute that passes to reflect the state of that stock. A candle stick has metrics like Closing price (last known price within a minute), High Price (maximum price within a minute)...etc. One

How to fill missing timestamps for Time column for a date in pandas

别等时光非礼了梦想. 提交于 2020-12-12 13:27:59
问题 I have a time-series data as below: print(df) ric datel timel val 0 xyz 2017-01-01 09:00:00 2 1 xyz 2017-01-01 09:04:00 5 2 xyz 2017-01-01 09:37:00 6 Now I have to fill missing timestamps upto 09:45:00 . Expected Output: ric datel timel val 0 xyz 2017-01-01 09:00:00 2 1 xyz 2017-01-01 09:01:00 nan 2 xyz 2017-01-01 09:02:00 nan 3 xyz 2017-01-01 09:03:00 nan 4 xyz 2017-01-01 09:04:00 5 ... ... 37 xyz 2017-01-01 09:37:00 6 ... ... 45 xyz 2017-01-01 09:45:00 nan What I tried : df1=df.resample("1