Home > Mobile >  How to apply the find method to a series
How to apply the find method to a series

Time:12-22

I get this error:

AttributeError: 'Series' object has no attribute 'find'  



 indexNames = newDF[newDF["Name"].find("Peanut") != -1].index

 newDF.drop(indexNames , inplace=True)

The newDF DataFrame is this:

ProductID             int64
Description          object
Name                 object
Manufacturer         object
SumOfQtyOfProduct     int64

CodePudding user response:

Try using .str.find instead of .find:

indexNames = newDF[newDF["Name"].str.find("Peanut") != -1].index
  • Related