You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [26]: pd.Series(['a', 'b', 4]).str.match('a')
Out[26]:
0True1False2NaNdtype: objectIn [27]: pd.Series(['a', 'b', 4]).str.match('a', as_indexer=True)
# C:\Users\username\AppData\Local\Continuum\Anaconda3\Scripts\ipython:1: FutureWarning: 'as_indexer' keyword was specified but is ignored (match now returns a boolean indexer by default), and will be removed in a future version.Out[27]:
0True1False2NaNdtype: object
Problem description
The warning states that match (and similarly for search) returns a boolean indexer by default, yet that's not the case for numeric input, as the example shows.
This one caught me off guard as it caused an indexing error in a piece of code that assumed that the result of match could be used as a mask regardless of input types.
Expected Output
The output currently obtainable by letting na=False:
In [33]: pd.Series(['a', 'b', 4]).str.contains('a', na=False)
Out[33]:
0True1False2Falsedtype: bool
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Windows
OS-release: 8.1
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, Genuin
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
maybe my search is not working properly (as this is not listed as all), but this is versionchanged in 0.21.0 on the change, hence we would remove > 0.24, @TomAugspurger ?
Code Sample, a copy-pastable example if possible
Problem description
The warning states that
match
(and similarly forsearch
) returns a boolean indexer by default, yet that's not the case for numeric input, as the example shows.This one caught me off guard as it caused an indexing error in a piece of code that assumed that the result of
match
could be used as a mask regardless of input types.Expected Output
The output currently obtainable by letting
na=False
:Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Windows
OS-release: 8.1
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, Genuin
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: 3.3.2
pip: 18.0
setuptools: 38.4.0
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.3
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 0.9999999
sqlalchemy: 1.2.8
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: