import pandas as pd import numpy as np import re CONTAINS_REG_EXP = ur'{0}' value = '3' t1 = pd.Series(data=[np.nan, np.nan, np.nan], dtype=np.object) t2 = t1.str.contains(CONTAINS_REG_EXP.format(re.escape(value)), flags=re.U, na=False) print t2Expected Output
0 False
1 False
2 False
dtype: bool
output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Linux
OS-release: 4.2.0-42-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.17.1
nose: None
pip: 8.0.3
setuptools: 18.0.1
Cython: 0.23.4
numpy: 1.10.1
scipy: None
statsmodels: None
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.6
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.6.1 (dt dec pq3 ext lo64)
Jinja2: None
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4