我正在嘗試根據(jù)每個 for 循環(huán)輸出的切片結(jié)果構(gòu)建一個大數(shù)據(jù)集。我所做的代碼如下: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,:]如您所見,從數(shù)據(jù)列中,如果我對輸出進行切片,則僅顯示案例 3 的輸出,我想要一個大文件,同時包含案例 0、1、2、3。
添加回答
舉報
0/150
提交
取消