I'm trying to implement predictive analytics on a production data. my goal is to predict next downtime, it's reason and issues.

My data looks like below;

import pandas as pd

data = {'Date': ['16-08-2021', '16-08-2021', '17-08-2021', '18-08-2021', '19-08-2021 5'],
        'Reason no': ['R13', 'R2', 'R5', 'R2', 'R3'],
        'Minutes': [115, 625, 625, 1364, 1440],
        'Issues': ['Not meeting the hourly target output', 'Air leak issue', 'other problem', 'Air leak issue', 'Air leak issue']}

df = pd.DataFrame(data)

enter image description here we can see on 16-08-2021 we have 2 downtimes of different categories. so what we can do is modify this data into 2 separate time stamp. like '16-08-2021 1AM', '16-08-2021 4AM' and also assign time features to all other dates. Minutes is the downtime, My goal is to forecast the next downtime for next 2 days (which can be like e.g

'Date': ['20-08-2021 5AM', '20-08-2021 6PM', '21-08-2021 12AM'],
        'Reason no': ['R5', 'R2', 'R2'],
        'Minutes': [655, 142, 425],
        'Issues': [ 'Air leak issue', 'other problem', 'Air leak issue']}

what i have seen is most tutorial just treat datetime data as id and ignores it, but in my case date and timestamp is an important tool. i want to train my model using LSTM and other hybrid technique.

So, How can I deal multiple data of same date using pandas and python. And keep date-time as a feature variable. kindly looking for help. Thank you. Also looking for any additional insights and suggestions.


1 Answer 1


RNNs generally work best with equally spaced time stamps. For example, the stock prices can be fed into an LSTM model every 2 days, and a Large Language Model takes in every single character. To do what you're suggesting, their are 2 solutions.

Solution 1: Make a language model and train it off of your data. Then when you want to predict a date, you can input a date into the model. Ex: After inputting all your previous data, input "Date: '20-08-2021" and the model predicts the rest. This solution can predict multiple data points on the same date, but training a language model like this can be very difficult, and it might be worse at predicting correctly.

Solution 2: If it is possible for you to have a single data point for each hour, then you can treat each hour as its own piece of data, but since you don't have data for every hour, leave certain hours empty. Ex: "Data1, Empty, Empty, Empty, Data2, Empty, Empty, Data3" You're going to have to structure your input and output layer to support the variables you want to predict.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.