str.extract output assignment behavior inconsisent and broken in some cases #25582
Labels
Duplicate Report
Duplicate issue or pull request
Indexing
Related to indexing on series/frames, not to indexes themselves
Problem description
Assigning the extraction of groups to a column fails if using the .loc method. The column is filled with NaN, regardless of if there is a match or not. Pre-filling the column with empty strings 'fixes' it.
This behavior is strange, and I spent a long time trying to figure out what is wrong, as it does not raise an error or anything.
case 1 output
Expected case 1 Output
Output of
pd.show_versions()
pandas: 0.24.1
pytest: 4.0.2
pip: 18.1
setuptools: 40.6.3
Cython: 0.29.2
numpy: 1.15.4
scipy: 1.2.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.5.0
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 2.2.3
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml.etree: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: