Python Replace Elements In Array