Questions tagged [time-series]

A Time series is a sequence of data points with values measured at successive times (either in continuous time or at discrete time periods). Time series analysis exploits this natural temporal ordering to extract meaning and trends from the underlying data.

Time series data is data with a pattern (“trend”) over time. Quantitative forecasting can be applied when two conditions are satisfied:

  1. numerical information about the past is available;
  2. it is reasonable to assume that some aspects of the past patterns will continue into the future.

Time series data are useful when you are forecasting something that is changing over time (e.g., stock prices, sales figures, profits, etc.). Examples of time series data include:

  • Daily IBM stock prices
  • Monthly rainfall
  • Quarterly sales results for Amazon
  • Annual Google profits

https://www.otexts.org/fpp/1/4

Time series models attempt to make use of the natural one-way ordering of time so that values for a given period will be expressed as a function of past values. This same idea is used in time series forecasting — future values based on past data.

Typically, time series data points are spaced at uniform time intervals.

A time series model will generally reflect the fact that observations close together in time will be more closely related than observations further apart.

As a place to start, take a look at Wikipedia's page on time series. For further reading, refer to the Statsoft website which has an online textbook on time series analysis.

For time series analysis in , consider looking at the Time Series Task View and questions tagged for the zoo package and for the xts package.


Tag usage:

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis or Data Science, the StackExchange site for Data Science related topics like time series.

15192 questions
3
votes
1 answer

Plot the YoY price correlation in python. (Plot the correlation of Dataframe rows)

In the context of trying to plot the YoY correlation of a DataFrame in Python. The question is how does one get the 3 pair-wise correlation coefficients representing each pair of the variables "AAPL", "IBM" and "MSFT" correlation each year. Then…
user4933
  • 1,485
  • 3
  • 24
  • 42
3
votes
1 answer

PySpark Dataframe forward fill on all columns

I have the following problem. I have a dataset that keeps track of changes of a status. id valid eventdate 1 False 2020-05-01 1 True 2020-05-06 2 True 2020-05-04 2 False 2020-05-07 2 True 2020-05-09 3 False 2020-05-11 Goal: SELECT…
JQadrad
  • 541
  • 2
  • 16
3
votes
1 answer

Pandas: Convert Quarterly Data into Monthly Data

I have some quarterly data that I need to convert to monthly in order to work with another data set. The data looks like this: Date Value 1/1/2010 100 4/1/2010 130 7/1/2010 160 What I need to do is impute the values for the missing months so that…
Ragnar Lothbrok
  • 1,045
  • 2
  • 16
  • 31
3
votes
2 answers

How define CustomBusinessHour all day long?

I analyze the running of devices hour per hour that work 24 hours a day (but not all the year), but I have error with: from pandas.tseries.offsets import CustomBusinessHour Use=CustomBusinessHour( start='00:00', end='24:00', …
dge
  • 41
  • 4
3
votes
2 answers

Strange behavior from to_datetime()

I have really been having a tough time here. My DataFrame looks like this Purchase_Date Customer_ID Gender 0 2012-12-18 00:00:00 7223 F 1 2012-12-20 00:00:00 7841 M 2 2012-12-21 00:00:00 8374 …
3
votes
1 answer

What exactly does the Scipy: signal.detrend (type='constant' ) do a time series data set and can I reverse signal.detrend in python?

I am currently trying to model a Multivariate Random Forest on time series data. The only way I get decent test accuracies on the model is to detrend the data before modelling using the scipy detrend type=constant (the type=linear does not give good…
Kirsty
  • 33
  • 3
3
votes
1 answer

Export multiple GluonTS forecasts to pandas dataframe

I have multiple time series that I would like to forecast with GluonTS, then concatenate so my result is a pandas data frame with the column headers date, y (the target), series (the series number). The problem is that GluonTS produces a generator.…
Alex
  • 2,603
  • 4
  • 40
  • 73
3
votes
1 answer

Python: Finding time taken for each event in dataframe based on condition

I have a df with two columns, timestamp & eventType. timestamp is ordered in chronological order, and eventType can be either ['start', 'change', 'end', resolve]. ['start', 'change'] denotes the start of an event ['end','resolve'] denotes the end…
e-o-rino
  • 31
  • 2
3
votes
1 answer

Forward fill certain columns with specified frequency for time series data

I want to forward fill 2 columns: Time and X in df: Time X Y Z 0 2020-01-15 06:12:49.213 0 0 0 1 2020-01-15 08:12:49.213 1 2 2 2 2020-01-15 10:12:49.213 3 6 9 3 2020-01-15 12:12:49.213 12 15 4 4 …
nilsinelabore
  • 4,143
  • 17
  • 65
  • 122
3
votes
4 answers

How do I use a common axis for three similar time/value graphs

I have three timestamped measurement series, taken over the same interval, but with different actual timestamps. I'd like to show these three trajectories in a combined plot, but because the x-axis (timestamps) is different in each case, I'm having…
William Gunn
  • 2,925
  • 8
  • 26
  • 22
3
votes
1 answer

timeseries and dplyr, event detection (datechange problem)

I hope somebody can help me with the following event-detection problem. The input-data is a timeseries (regular). It contains "time", "waterlevel" and "runoff". The aim is to detect events above threshold and extract the time when it starts, the…
3
votes
0 answers

Hidden Markov Model (HMM) in python (hmmlearn) always predicting same value for time series

I have been attempting to use the hmmlearn package in python to build a model predicting values of a time series. I have based my code on this article, detailing how to use the package for a stock price time series. After fitting the model on a…
3
votes
2 answers

Add trendline for timeseries graph

I want to add a trendline for a timeseries graph in python, that means my x-axis (Datum) has the format of datetime64[ns], when I am following this thread: How to add trendline in python matplotlib dot (scatter) graphs? and run my code: import numpy…
PV8
  • 5,799
  • 7
  • 43
  • 87
3
votes
1 answer

matplotlib. Change color of line based on values in other column keeping x axis same

I have following dataset: import pandas as pd import matplotlib.pyplot as plt dict = {'time':["2017-01-02", "2017-01-03", "2017-01-04", "2017-01-05", "2017-01-06"],'val':[3.2, 10.2, 11.3, 4.9, 2.3], 'class': [0, 1, 1, 0,0]} df =…
Sascha
  • 687
  • 1
  • 8
  • 22
3
votes
2 answers

make time series data frame in R

My data I acquired were missing some parts. DAY<-c("2011-01-01","2011-01-02","2011-01-04","2011-01-06") ITEM<-c("apple","apple","apple","banana") sale<-c("yes","no","yes","yes") value<-c(100,200,100,500) df <-…
h-y-jp
  • 199
  • 1
  • 8
1 2 3
99
100