Manipulate data efficiently in Python | Other