Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Ignoring NaNs with str.contains

In [11]: df = pd.DataFrame([["foo1"], ["foo2"], ["bar"], [np.nan]], columns=['a'])

In [12]: df.a.str.contains("foo")
Out[12]:
0     True
1     True
2    False
3      NaN
Name: a, dtype: object

In [13]: df.a.str.contains("foo", na=False)
Out[13]:
0     True
1     True
2    False
3    False
Name: a, dtype: bool
Comment

PREVIOUS NEXT
Code Example
Python :: how can you make a data fram 
Python :: rich content field django ckeditor not showing bullets 
Python :: pandas mappin ID to value in different row 
Python :: With Python, it is possible to use the ** operator to calculate powers 
Python :: pypi cryptography 
Python :: create new column with first character of string pyspark 
Python :: winwin 
Python :: multiKey dict error 
Python :: plotly scroll zoom 
Python :: python scatter matrix with regression line 
Python :: Python RegEx re.compile() Set class [s,.] will match any whitespace character ‘,’ or ‘.’ 
Python :: child urls python 
Python :: svm classification involving pipelines 
Python :: python list example 
Python :: NMF cosine similarities 
Python :: raspian image with preinstalled python3 
Python :: how to print continuesly in the same line in python 
Python :: a Python Numbers 
Python :: allow django imagefield accept base 64 image 
Python :: python check if variable is module 
Python :: Move x-ticks to the middle of each bin 
Python :: def print_seconds(hours minutes seconds) print() print_seconds(1 2 3) 
Python :: how to give order in boxplot matplotlib 
Python :: qubesos 
Python :: rebuild database from zero django postgres 
Python :: moving element to the start ofa list python 
Python :: returns the dataframe with the modified Title column in which the updated groupings are reflected. 
Python :: reportlab drawimage issues with png transparency background 
Python :: how to get user id discord.py 
Python :: détruire une variable python 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =