【发布时间】:2015-07-10 23:46:07
【问题描述】:
我使用非常大的数据集 (1.5gb+) 并对其进行部分字符串搜索。
我能够为我的工作编写一个脚本,但是时间太长了:
fhand = open('C:/Users/promotor/Documents/tce-sagres/TCE-PB-SAGRES-Empenhos_Esfera_Municipal.txt','r')
pergunta = raw_input('Pesquisa: ')
fresult = open('resultado.csv','w')
for line in fhand :
#linha = linha + 0.001
#update_progress(int(linha)*1000)
if pergunta in line :
print line
fresult.write(line)
print "terminado."""
我想知道在 Pandas 上是否有更快的方法来做到这一点。我尝试了 str.contains,但我只能搜索一列。我想知道是否有更快的方法。我尝试了“str.contains”,但只能搜索一列。
最好的问候。
【问题讨论】:
标签: string search pandas row partial