I need to replace parts of abbreviated addresses with the full address in a new csv but keep running into an error. How do I fix this?
1234 Edison Ln -----------> 1234 Edison Lane
4589 Stack Overflow Dr -----------> 4589 Stack Overflow Drive
import pandas as pd
mycsv = pd.read_csv('addressescsv')
mycsv['Address'] = str.replace({mycsv['Address']: {'Ln': 'Lane','Dr': 'Drive'}})
mycsv.to_csv('newAddressescsv', index=False)
Traceback:
Traceback (most recent call last):
File "C:\movingalong.py", line 8, in <module>
File "C:\Users\Programs\Python\Python36-32\lib\site-
packages\pandas\core\generic.py", line 831, in __hash__
' hashed'.format(self.__class__.__name__))
TypeError: 'Series' objects are mutable, thus they cannot be hashed