How can I get an array of alternating values in python?

后端 未结 7 1879
臣服心动
臣服心动 2020-12-30 01:06

Simple question here:

I\'m trying to get an array that alternates values (1, -1, 1, -1.....) for a given length. np.repeat just gives me (1, 1, 1, 1,-1, -1,-1, -1

7条回答
提交回复
热议问题