dict

NumPy array append slow

For a university project I need to implement an inverted index in python. This consists of a dictionary containing NumPy arrays, to which I append new values as I process more text. We've been told to use NumPy instead of regular Python lists, to decrease memory usage as it is possible to use smaller defined datatypes. However using list append and then swapping the value in the dictionary proves to be terribly slow. Is there a better way to implement this?
Subscribe to dict