【问题标题】:Python Pandas Series.any() ==Python Pandas Series.any() ==
【发布时间】:2020-10-20 00:18:10
【问题描述】:

我是否正确使用了熊猫?我正在尝试遍历文件并查找系列中的任何值是否匹配

import pandas as pd

path = user/Desktop/New Folder
for file in path:
     df = pd.read_excel(file)
     if df[Series].any() == "string value"
          do_something()

     

【问题讨论】:

    标签: pandas any


    【解决方案1】:

    请检查这是否解决了您的问题:

    if df[df['your column']=="string value"].any()
        do_something()
    

    我认为你也应该修复你的文件迭代,请检查:https://www.newbedev.com/python/howto/how-to-iterate-over-files-in-a-given-directory/

    【讨论】:

      猜你喜欢
      • 2018-07-13
      • 2015-10-12
      • 2021-01-15
      • 2015-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-16
      相关资源
      最近更新 更多