I have a total of 38-time samples in the timeline excel file. I would like to export these specific rows and all columns based on my timeline intervals.
Presently, I am doing it a very hard way by putting each value manually in the code given and then exporting a single excel sheet. Is there a code that can help me reduce my time spent extracting multiple datasets? This would be really helpful.
Here is the present code that I am using
import pandas as pd import numpy as np dat = pd.read_csv('sample.csv') dat.head(3) dat = dat[dat[' timestamp'] != 'Mean'] dat = dat[dat[' timestamp'] != 'mean'] dat['time'] = dat [' timestamp'].astype(float) dat.head(3) ndat = dat[dat['time'].between(37, 64)] ndat.head(2) ndat.tail(2) ndat.to_excel('sample1.xlsx)