Hi MRAB, Here is an example: In the original dataframe, I have something like, 'Agronomía'. And I try to transform it to 'Agronomia'. In this case, I try to replace í with i: the former with a Spanish accent, the latter without.
Thanks Best On Wed, Aug 5, 2020 at 8:00 PM MRAB <pyt...@mrabarnett.plus.com> wrote: > On 2020-08-05 23:21, Michio Suginoo wrote: > > Hi, > > > > I have trouble with .replace() method in a Pandas DataFrame. > > My code is something like this: > > correction_dic1 = {'á': 'a', 'í': 'i', 'ú': 'u', 'ó': 'o'} > > df = df.replace({'Name' : correction_dic1}) > > Basically, what I am trying to do here is to replace bowels with Spanish > > accent with a plain set of English alphabet in all the entries in the > > column called 'Name' in the dataframe, df. > > > > A strange thing is that it worked perfectly in the same Jupyter notebook > > this morning. > > But all of a sudden, it started not doing the replacement any more. > > > > Could anyone tell what could be the problem? > > > Does that replace characters in strings, or does it replace one string > with another, e.g. replace the string 'á' with the string 'a'? > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list