Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Replicate looks like numpy's repeat. For example

  np.repeat(list("abcd"), [2,1,0,2])
is equivalent to the first example in the link.


Ah, thank you! I'd tried to find this for implementing BQN in NumPy (never finished) and didn't. Maybe I thought it only worked with a scalar for the number of repetitions.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: