【问题标题】:How to apply the find method to a series如何将 find 方法应用于系列
【发布时间】:2022-01-23 03:59:31
【问题描述】:

我收到此错误:

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



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

 newDF.drop(indexNames , inplace=True)

newDF DataFrame 是这样的:

ProductID             int64
Description          object
Name                 object
Manufacturer         object
SumOfQtyOfProduct     int64

【问题讨论】:

标签: python-3.x pandas


【解决方案1】:

尝试使用.str.find 而不是.find

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

【讨论】:

    猜你喜欢
    • 2022-01-10
    • 2019-05-22
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-20
    相关资源
    最近更新 更多