time-series

How to get count of values based on datetime in Python

不羁岁月 提交于 2020-07-20 03:46:06
问题 I have written the following code which creates two dataframes nq and cmnt . nq contains the UserId and corresponding time of Badge Attainment date . cmnt contains OwnerUserId and the time when the User made a comment CreationDate . I want to get a count of the comments made for all days before and after 1 week of badge attainment so that I can create a time series line plot out of it. The following code perform the same but produces a KeyError. Please provide a code that performs this

Time series data preprocessing - numpy strides trick to save memory

生来就可爱ヽ(ⅴ<●) 提交于 2020-07-18 06:38:49
问题 I am preprocessing a timeseries dataset changing its shape from 2-dimensions (datapoints, features) into a 3-dimensions (datapoints, time_window, features). In such perspective time windows (sometimes also called look back) indicates the number of previous time steps/datapoints that are involved as input variables to predict the next time period. In other words time windows is how much data in past the machine learning algorithm takes into consideration for a single prediction in the future.

Custom time series resampling in Pandas

梦想的初衷 提交于 2020-07-18 03:00:41
问题 I have a df with OHLC data in a 1m frequency: Open High Low Close DateTime 2005-09-06 18:00:00 1230.25 1231.50 1230.25 1230.25 2005-09-06 18:01:00 1230.50 1231.75 1229.25 1230.50 . . 2005-09-07 15:59:00 1234.50 1235.50 1234.25 1234.50 2005-09-07 16:00:00 1234.25 1234.50 1234.25 1234.25 I need to do a "custom" resample that fits futures hours data where: Every day starts at 18:00:00 of the previous day (Monday starts on Sunday 18:00:00) Every day ends at 16:00:00 of the current day The

How to detect outlier peaks in a water flow time series?

♀尐吖头ヾ 提交于 2020-07-09 06:32:56
问题 TL;DR: Have water flow time series needed to be treated, can't figure it out a way to remove outlier peaks. I'm currently working in a project where I receive a .csv dataset containing two columns: date, a datetime timestamp value, a water flow value This dataset is usually one year of measures of a water flow sensor of a management entity with automatic irrigation systems, containing around 402 000 raw values. Sometimes it can have some peaks that doesn't correspond to a watering period,

Creating a time series in R with a row every 15 minutes

强颜欢笑 提交于 2020-06-29 13:13:57
问题 I'm having trouble creating a time series (POSIXct or dttm column) with a row every 15 minutes. Something that will look like this for every 15 minutes between Jan 1st 2015 and Dec 31st 2016 (here as month/day/year hour:minutes): 1/15/2015 0:00 1/15/2015 0:15 1/15/2015 0:30 1/15/2015 0:45 1/15/2015 1:00 A loop starting date of 01/01/2015 0:00 and then adding 15 minutes until 12/31/2016 23:45? Does anyone has an idea of how this can be done easily? Thanks! 回答1: Little bit easier to read

Creating a time series in R with a row every 15 minutes

最后都变了- 提交于 2020-06-29 13:12:02
问题 I'm having trouble creating a time series (POSIXct or dttm column) with a row every 15 minutes. Something that will look like this for every 15 minutes between Jan 1st 2015 and Dec 31st 2016 (here as month/day/year hour:minutes): 1/15/2015 0:00 1/15/2015 0:15 1/15/2015 0:30 1/15/2015 0:45 1/15/2015 1:00 A loop starting date of 01/01/2015 0:00 and then adding 15 minutes until 12/31/2016 23:45? Does anyone has an idea of how this can be done easily? Thanks! 回答1: Little bit easier to read

R: Forecasting multiple time series with fable, tsibble and map

与世无争的帅哥 提交于 2020-06-29 06:50:29
问题 I am trying to fit some time series using the R packages tsibble and fable , the still-under-construction replacement for the redoubtable Rob Hyndman's forecast package. The series are all combined into one tsibble, which I then fit with ARIMA, a function which replaces, among other things, forecast::auto.arima . I use map_at , first to iterate over all the elements except the Date , and then again to extract the model information from the models that have been fit to each series using

R: Forecasting multiple time series with fable, tsibble and map

我的梦境 提交于 2020-06-29 06:50:01
问题 I am trying to fit some time series using the R packages tsibble and fable , the still-under-construction replacement for the redoubtable Rob Hyndman's forecast package. The series are all combined into one tsibble, which I then fit with ARIMA, a function which replaces, among other things, forecast::auto.arima . I use map_at , first to iterate over all the elements except the Date , and then again to extract the model information from the models that have been fit to each series using

R^2 score is not well-defined with less than two samples. Python Sklearn

╄→гoц情女王★ 提交于 2020-06-29 03:50:26
问题 I am using a Linear Regression classifier to predict some values. I already figured the basic part of the out and now it looks like this: import time as ti import pandas as pd import numpy as np from matplotlib import pyplot as plt import csv from sklearn.datasets import load_boston from sklearn import preprocessing, svm from sklearn.model_selection import train_test_split from sklearn import linear_model from scipy.interpolate import * import datetime data = pd.read_csv(r"C:\Users\simon

How to conver 'Sat Feb 02 12:50:00 IST 2019' to regular datetime in python?

。_饼干妹妹 提交于 2020-06-29 03:41:13
问题 I am trying to convert this column of my dataframe 'Sat Feb 02 12:50:00 IST 2019' to regular datetime format ie(2019-05-02 12:00:00) in python How do i convert all the rows to this format? 回答1: Assuming you don't need your datetime Python object to be timezone aware, you could just use strptime as follows: dt = "Sat Feb 02 12:50:00 IST 2019" out = datetime.strptime(dt, "%a %b %d %H:%M:%S IST %Y") print(out) This prints: 2019-02-02 12:50:00 来源: https://stackoverflow.com/questions/62370051/how