import pandas as pd
x = pd.read_csv(r"filePath")
x.columns = x.columns.str.lower().str.replace(' ', '_')
y = x.columns.values
z = y.tolist()
print("Note: It take Case Sensitive Values.")
keyWord = input("Type a Keyword to Search: ")
try:
for k in range(len(z)-1):
l = x[x[z[k]].str.match(keyWord)]
print(l.head(10))
k = k+1
except:
print("")
您可以尝试以下代码:
可以对整个数据帧执行相等比较:
另一个选项是使用
numpy
比较:您应该使用
isin
,这是返回列,是要行冷检查'答案:-)或者
相关问题 更多 >
编程相关推荐