python - Append dataframe in nested loop in pandas -
i have 2 dataframes dfnew , dfrest , using them in nested loop below, , new dataframe newtempdf = pd.dataframe()
.
i want collect entries of z when m> 70 in newtempdf
also, how can join in better way?
for x, y in dfnew.iterrows(): dfrestnew = dfrest[dfrest['zip'].isin([y[4],'blank'])] = str(y['companyname'])+' '+str(y['address'])+' '+str(y['city'])+' '+str(y['state'])+' '+str(y['zip']) = i.lower() x1, z in dfrestnew.iterrows(): m = 0 j = str(z['companyname'])+' '+str(z['address'])+' '+str(z['city'])+' '+str(z['state'])+' '+str(z['zip']) j = j.lower() score = fuzz.ratio(i, j) if score>=m: m = score if m> 70: # how append in newtempdf??
sample df ((sep=',')
easier formatting):
companyname,address,city,state,zip,country austin cake studio,1504 chisholm trl,round rock,tx,78681,us magee's bakery,8188 orangeburg rd,maysville,ky,41056,us sweet shoppe,1200 kay dr, olney,tx,76374,us
Comments
Post a Comment