Replacing Strings In Pandas Column

You can use str.extract:

df[0].str.extract('^([^\.]+)')

Output:

           0
1     France
2     France
3    Germany
4    Germany
5    Germany
6      Spain
7      Spain
8      Spain
175   France
176   France
177  Germany
178  Germany
179  Germany
180       UK
181       UK
182       UK
183    Italy
184    Italy
185    Italy

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top