有没有办法将reduce与numpy的append一起使用?我想像这样将 3 个数组 append 在一起:
a = np.array([1,2,3])
b = np.array([11,12,13])
c = np.array([21,22,23])
#below is my real code - the above is just for this example)
np.append.reduce((a,b,c))
但看起来reduce 没有用append 实现。感谢您的任何建议。
输出应该是:
array([ 1, 2, 3, 11, 12, 13, 21, 22, 23])
最佳答案
np.r_[] 会干净地完成此操作...
a = np.array([1,2,3])
b = np.array([11,12,13])
c = np.array([21,22,23])
#below is my real code - the above is just for this example)
np.r_[a,b,c]
关于python - Numpy 中的归约和追加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56877033/