Pandas dataframe search and modify leading zero on postal codes
Solution of df = df[0].apply(lambda x: '0' + str(x) if x < 10000 else str(x)) is perfect. It convert the code to full string and then I can find GPS coordinates correspondant to national postal infos.
Many thanks.
I have a pandas DataFrame database of location and postal code addresses. But postal codes have been interpreted from Excel reading. For example, in France postal addresses are a department code followed by city code, e.g. 75600 (75 = 'Paris region', 600 = 'inner city').
But in some first postal codes, e.g. 01200 it have interpreted like 1200. How can I search integer values below 10000 and modify them? Or how to preserve the first zero. How to search and replace in a dataframe and use the content (to modify it)?