python - Sorting by instructions -


i have vector/column length 1000 , values 1,2.

how can sort vector/column obtain result like:

1 2 1 2 1 2 etc.  

in r:

some sample-data:

x <- sample(1:2, 1000, replace = true) 

do:

x[match(rep(1:2, 500), x)] 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -