【发布时间】:2021-07-26 19:23:08
【问题描述】:
我想要做的是将搜索功能添加到数据框中。我希望能够输入一个文件名并保存它发现的行。这样,当我使用 iloc 时,它会一起返回“文件名”和“修改数据”。
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]])
【问题讨论】:
标签: python pandas dataframe logic