我有一个getX()
,它为图像的每一帧提供2D array(shape=(18,2))
作为输出。我想将此不断更新的数组添加到CSV。
我使用了以下代码。但这只给我一行(可能只有一帧)。
with open("data.csv",mode ='w') as csvfile:
wr = csv.writer(csvfile, quoting = csv.QUOTE_ALL,dialect="excel")
get_val = oneObject.getX(currentFrameIndex)
for humanPos in get_val:
wr.writerow(humanPos)
答案 0 :(得分:1)
为什么不累积子数组,然后仅使用const compareBySliceA = (prevSate: RootState, newState: RootState) => {
// This is just an example you can compare inner of Slice A
if (newState.SliceA === prevState.SliceB) {
return true
}
return false;
};
const getDerivedSliceB (state: RootState): List<any> =>
state.SliceB.filter(ElementB => ElementB.visible)
const createComparatorSelector = createSelectorCreator(
defaultMemoize,
compareBySliceA,
);
export const myDeepSelector = createComparatorSelector(
(state: RootState) => state,
(state: RootState): List<any> => getDerivedSliceB(state),
);
一次写入CSV?
np.savetxt