Skip to content

Tag: pandas

How to subtract date and time in Pandas?

I have data from Pandas which was the contents of a CSV file: I aim to convert the column Date from timestamps to time periods in units of minutes, which should result in something like the following: Answer You can use subtract the first timestampe to calculate the difference, then get total_seconds() and co…

Getting min and max datime for each date in csv

I’m kind of new to data science and Python. First of all, do you suggest using any other Library than pandas when dealing with huge dataset (100K+ rows)? Second of all, let me expose to you my current problem. I have a Dataset in which I have a Datetime column, to make it easy to understand, let’s…

PyTorch: Dataloader for time series task

I have a Pandas dataframe with n rows and k columns loaded into memory. I would like to get batches for a forecasting task where the first training example of a batch should have shape (q, k) with q referring to the number of rows from the original dataframe (e.g. 0:128). The next example should be (128:256, …