Fix errors caused by pandas upgrade
Tentatively fixing a map indexing error
Adding lines that will hopefully prevent memory form exploding