Skip to content
Advertisement

Tag: time-series

Autofill datetime in Pandas by previous increment

Given previous datetime values in a Pandas DataFrame–either as an index or as values in a column–is there a way to “autofill” remaining time increments based on the previous fixed increments? For example, given: I would like to apply a function to yield: B 2013-01-01 09:00:00 0.0 2013-01-01 09:00:05 1.0 2013-01-01 09:00:10 2.0 2013-01-01 09:00:15 NaN 2013-01-01 09:00:20 4.0 Where

Python – How to clean time series data

I have a df which looks like this: I’m trying to create a new column called ‘First_Contract’: ‘First_Contract’ needs to take the third-last value of ‘Sep’ column, before ‘Sep’column reaches NaN. The subsequent values need to be filled with ‘Dec’ column values. Desired output: How do I go about to achieve this? Answer Let us do it step by step

Equidistant timeseries filling the blanks

I have the following code that generates a timeseries with 1 min steps but would like to have the time gaps filled. i.e 13:58 is missing in between. Every ip should be represented in the gap with zero values. How can this be achieved? Answer First change unstack by first level for DatetimeIndex, and add DataFrame.asfreq for add missing minutes:

Machine Learning Classifier use past predictions as features

I want to built a binary classifier machine learning model. I want to use the model’s previous predictions as features for the future predictions, to take into account that my training samples are not independent. Is there a framework to achieve this with scikit-learn, or any other python ML library? I know this problem could be solved with memory-based Neural

Advertisement