python - Script only runs till certain point in for loop, then stops with no errors:using -
i have dataframe called urlclean in form of:
>>> urlclean matches searching url list url status 14 2 green index http://greenindex.timberland.com/ works
as derived preliminary dataframe index "14" @ row 1. have written secondary code open url in "url list" , search possible repetitions of phrase under "searching for" (in case, green index) in text of selected url follows:
for cindex, row in urlclean.iterrows(): print("starting clea nup") sentence=[] sentence=urlopen(urlclean.loc[cindex,'url list']).read() print("opening urls") soup=[] soup=beautifulsoup(sentence) print("getsoup") rsentence=[] rsentence=(soup.get_text()) print("gettect") indices = (i i,word in enumerate(rsentence) if word== (urlclean.loc[cindex,'searching for'])) print("getting indices") neighbors = [] ind in indices: neighbors.append(rsentence[ind-2:ind]+rsentence[ind:ind+2]) print("opening rsetence",(rsentence[ind- 2:ind]+rsentence[ind:ind+2])) resulting=[] print("got neighbors", neighbors) n=len(neighbors) indexx in range(0,n): resulting_temp=[] resulting_temp=[(' '.join(map(str,neighbors[indexx])))] print("resulting temp",resulting_temp) urlclean.loc[cindex,'all phrases']=resulting_temp resulting.append(resulting_temp) print("got results", resulting)
i included print() follow upto point code runs, quite literally ouputs formerly derived dataframes, , exists above code after writing:
starting cleanup opening urls getsoup gettect getting indices >>>
it never starts loop ranges between ind , indices, missing something? new python apologies if elementary problem.
Comments
Post a Comment