Changed manupulations done with dictionaries to do them in the pandas dataframe