import numpy as np a = np.linspace(1, 5, 5) b = np.linspace(5, 9, 5) print(np.hstack((a, b))) print(np.split(a, 5)
运行结果:
[1. 2. 3. 4. 5. 5. 6. 7. 8. 9.] [array([1.]), array([2.]), array([3.]), array([4.]), array([5.])]
import numpy as np a = np.linspace(1, 5, 5) b = np.linspace(5, 9, 5) print(np.hstack((a, b))) print(np.split(a, 5)
运行结果:
[1. 2. 3. 4. 5. 5. 6. 7. 8. 9.] [array([1.]), array([2.]), array([3.]), array([4.]), array([5.])]