time-series

DataFrame: Rolling Year-to-Date cumulative STD (Time Series)

DataFrame: Rolling Year-to-Date cumulative STD (Time Series) Question: I have a DataFrame that looks something like this: daily_return year month day date 2018-12-27 NaN 2018 12 27 2018-12-28 1.020245 2018 12 28 2018-12-31 1.000650 2018 12 31 2019-01-02 1.020473 2019 01 02 2019-01-03 1.009129 2019 01 03 … … … … .. 2023-01-20 1.001087 2023 …

Total answers: 1

Aggregate hourly data and count duplicates in pandas python

Aggregate hourly data and count duplicates in pandas python Question: I have a dataframe df that looks like this: time Hit/Miss 2016-09-29 08:00:00 FN 2016-09-29 08:30:00 FN 2016-09-29 09:45:00 TP 2016-10-05 14:00:00 FP time is imported straight from a csv file without being set as an index, and Hit/Miss contains three categorical values FN, TP, …

Total answers: 1

Convert Time Series Data By Column Into Rows

Convert Time Series Data By Column Into Rows Question: I have output from a system which has multiple readings for a date range, date is one column and then each reading is a column of its own, an example data frame looks like this: Date/Time DEVICE_1 DEVICE_2 01/01 01:00:00 10.141667 8.807851 I would like to …

Total answers: 1

Find index of longest consectuive timespan in pandas time series

Find index of longest consectuive timespan in pandas time series Question: I have a time series with gaps (NaN) and I want to find the start and stop index of the longest consecutive sequence where no Nan occurs. I have no clue how to do that. values = [5468.0, 5946.0, np.nan, 6019.0, 5797.0, 5879.0, np.nan, …

Total answers: 1

Converting a numpy float array to datetime array

Converting a numpy float array to datetime array Question: I have a data in which the time are recorded as digits in each columns of a numpy array (dtype= float64) as shown here. year month day hour 2013 12 3 8.3478 2013 12 3 8.3480 2013 12 3 8.3482 2013 12 3 8.3488 2013 12 …

Total answers: 1

Using python pandas' Date time Offset does not get me the end of the month

Using python pandas' Date time Offset does not get me the end of the month Question: I have a time series dataframe at the monthly level where each month is denoted as the last day of the month. I need to loop through the dataframe one step at a time to get forecast from different …

Total answers: 1

How to convert multiple time zone column to UTC in Python

How to convert multiple time zone column to UTC in Python Question: I have a dataset where the date_time column contains a mixture of BST and GMT date and times, in the following format ‘Sun 27 Mar 2022 12:59:03 AM GMT’. I would like to convert this whole column into the following format ‘2022-03-27 00:59:03’, …

Total answers: 1

How to combine a masked loss with tensorflow2 TimeSeriesGenerator

How to combine a masked loss with tensorflow2 TimeSeriesGenerator Question: We are trying to use a convolutional LSTM to predict the values of an image given the past 7 timesteps. We have used the tensorflow2 TimeSeriesGenerator method to create our time series data: train_gen = TimeseriesGenerator( data, data, length=7, batch_size=32, shuffle=False ) Every image (timestep) …

Total answers: 1

Create weekly time series with DARTS from dataframe

Create weekly time series with DARTS from dataframe Question: How to create a time series with darts having weekly frequency? When having weekly data as follows: import pandas as pd df = pd.DataFrame({ ‘Date’ : [ pd.to_datetime(‘2022-12-05’), pd.to_datetime(‘2022-12-12’), pd.to_datetime(‘2022-12-19’), pd.to_datetime(‘2022-12-26’)], ‘Variable’: [10,21,23,24]}) I am struggling to get the correct freq as weekly: from darts import …

Total answers: 1

Select the dataframe based on the certain time value in pandas

Select the dataframe based on the certain time value in pandas Question: I have a dataframe df = pd.DataFrame([["A","11:40 AM"],["B","12:51 PM"],["C","6:33 PM"],["D","11:13 AM"],["E","7:13 PM"]],columns=["id","time"]) id time A 11:40 AM B 12:51 PM C 6:33 PM D 11:13 AM E 7:13 PM I want to select only those rows which are < 6:30 PM. Expected output: …

Total answers: 1