如何在python df中存储逻辑语句的行值

How to store the row value of a logic statement in python df

我想做的是将搜索功能添加到数据框中。我希望能够输入文件名并保存找到的行。这样,当我使用 iloc 时,它会将 return“文件名”和“modified_data”放在一起。

import pandas as pd
#....
df = pd.DataFrame(data, columns=['filename', 'modified_date'])
if df['filename'].str.contains('AAROW PDM Report') == TRUE:
    RowValue = #I want it to be equal to the row that was found true

print(df.iloc[[RowValue]])

尝试:

RowValue = df['filename'].str.contains('AAROW PDM Report').idxmax()