Numpy

import numpy
xx = numpy.array([(1, 2, 3), (4, 5, 6)])
print xx
print "xx[1]= %s" %xx[1]
print "xx[:1]= %s" %xx[:1]
print "xx[:, 0:1]=\n %s" %xx[:, 0:1]
print "xx[:, -2:-1]=\n %s" %xx[:, -2:-1]
print "hstack"
print numpy.hstack((xx[:, :1], (xx[:, -2:-1])))
print "vstack"
print numpy.vstack((xx[:, :1], (xx[:, -2:-1])))
Numpy_第1张图片
numpy.JPG

你可能感兴趣的:(Numpy)