I am trying to build a big dataset from the sliced result for each for loop output.
The code that i have made are as follows:
for n in range(4):
script_dir = os.path.dirname(directory)
rel_path = files[n]
abs_file_path = os.path.join(script_dir, rel_path)
to_open = pd.read_csv(abs_file_path, header=0)
to_open["Geographic Address"] = to_open["Geographic Address"].astype(str)
to_open["Geographic Address"] = to_open["Geographic Address"].map(lambda x: x[3:-1])
to_open = to_open[to_open["Geographic Address"] == ld_up[n]]
to_open.index = range(len(to_open))
ind = np.searchsorted(to_open["Time"], time[n])
ind = np.asscalar(np.array(ind))
UpperBound = ind - 30
data = to_open.iloc[UpperBound:ind,:]
So as you can see, from the data column, if I slice the output, only the output from case 3 is shown, I would like to have a big file while includes case 0, 1 ,2 ,3.