我正在尝试根据每个 for 循环输出的切片结果构建一个大数据集。我所做的代码如下: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,:]如您所见,从数据列中,如果我对输出进行切片,则仅显示案例 3 的输出,我想要一个大文件,同时包含案例 0、1、2、3。
添加回答
举报
0/150
提交
取消