Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Cannot mask with non-boolean array containing NA / NaN values

# if there are null values (e.g. NaN) values in the column, then the following
# error will show:
# "Cannot mask with non-boolean array containing NA / NaN values"
# setting na=False for the contains() method solves the problem
df['column_name'].str.contains(string_to_be_matched_with, na=False)
Comment

ValueError: cannot mask with array containing NA / NaN values

mask = dframe.Product.str.contains(word, case=False, na=False)
Comment

PREVIOUS NEXT
Code Example
Python :: get pytorch version 
Python :: ubuntu install python 3.8 
Python :: save df to txt 
Python :: How to config your flask for gmail 
Python :: invert dictionary python 
Python :: networkx remove nodes with degree 
Python :: python number of cpus 
Python :: python find dict in list of dict by id 
Python :: Python function remove all whitespace from all character columns in dataframe 
Python :: drop multiple columns pandas 
Python :: hyperlinks in jupyter notebook 
Python :: change date format python 
Python :: how do i print the entire array pthon jupyter 
Python :: python pie chart 
Python :: how to check datatype of column in dataframe python 
Python :: discord.py add role on member join 
Python :: python add month datetime 
Python :: save list pickle 
Python :: flask secret key generator 
Python :: perfect number in python 
Python :: How to get random int between two numbers python 
Python :: python half of string 
Python :: write a python program to read last n lines of a file 
Python :: convert seconds to hours python 
Python :: python pil image flip 
Python :: with font type stuff python turtle 
Python :: virtual environment mac 
Python :: hello world python 
Python :: how to sort a list by the second element in tuple python 
Python :: tkinter load image 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =