Re: How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex?

2017-03-22 Thread Irving Duran
You can do the following

df['field'] = df.replace(r'(? wrote:

> Hi, there,
> Can anyone help?
> How to search out all Zip codes and replace with the first 2 digits, in a
> Pandas dataframe, with the use of regex?
>
> For instance, a ZIP code 33132 was found and replaced with 33.
> Looking forward to hearing from you.
> Regards.
> David
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list

How to search out all Zip codes and replace with the first 2 digits, in a Pandas dataframe, with the use of regex?

2017-03-20 Thread David Shi via Python-list
Hi, there,
Can anyone help?
How to search out all Zip codes and replace with the first 2 digits, in a 
Pandas dataframe, with the use of regex?

For instance, a ZIP code 33132 was found and replaced with 33.
Looking forward to hearing from you.
Regards.
David
-- 
https://mail.python.org/mailman/listinfo/python-list