We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
I'm trying to remove certain characters in a DataFrame, in this case, I am trying to remove the ñ.
df = pd.DataFrame([['añoos','asññ','ÑolÑÑss'],['añoos','asññ','ÑolÑÑss']], dtype='string') df.replace({'ñ':'n', 'Ñ':'N'}, regex = True, inplace = True)
The output is:
If I do not specify the dtype to string, the output is the expected as follows:
string
df = pd.DataFrame([['añoos','asññ','ÑolÑÑss'],['añoos','asññ','ÑolÑÑss']]) df.replace({'ñ':'n', 'Ñ':'N'}, regex = True, inplace = True) print(df)
pd.show_versions()
commit : 2cb9652 python : 3.8.5.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19041 machine : AMD64 processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : es_419.UTF-8 LOCALE : Spanish_Colombia.1252
pandas : 1.2.4 numpy : 1.19.4 pytz : 2021.1 dateutil : 2.8.1 pip : 21.0.1 setuptools : 54.2.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 1.3.7 lxml.etree : 4.6.2 html5lib : None pymysql : 0.9.3 psycopg2 : 2.8.6 (dt dec pq3 ext lo64) jinja2 : 2.11.3 IPython : 7.22.0 pandas_datareader: None bs4 : 4.6.0 bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : 3.3.4 numexpr : None odfpy : None openpyxl : 3.0.6 pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : 1.5.1 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : 1.2.0 xlwt : None numba : 0.52.0
The text was updated successfully, but these errors were encountered:
if you simplify this to:
df = pd.DataFrame([['xax', 'xbx']], dtype='string') df = df.replace({'a': 'c', 'b': 'd'}, regex=True)
i confirm the issue exists on master
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
I'm trying to remove certain characters in a DataFrame, in this case, I am trying to remove the ñ.
Code Sample
The output is:
Problem description
If I do not specify the dtype to
string
, the output is the expected as follows:Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.5.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : es_419.UTF-8
LOCALE : Spanish_Colombia.1252
pandas : 1.2.4
numpy : 1.19.4
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 54.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.6.2
html5lib : None
pymysql : 0.9.3
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : 2.11.3
IPython : 7.22.0
pandas_datareader: None
bs4 : 4.6.0
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : None
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : 0.52.0
The text was updated successfully, but these errors were encountered: