Re: [Tutor] adding numpy to pandas

2018-06-21 Thread Peter Otten
Mats Wichmann wrote: > On 06/20/2018 02:04 PM, Glenn Schultz wrote: >> All, >> >> I have a pandas dataframe and a predict result (numpy array) of a >> classifier [[0,1],[1,0]]. What I would like to do is as the positive to >> the pandas dataframe. I use predict[:,1] to slice the postive from

Re: [Tutor] adding numpy to pandas

2018-06-21 Thread Mats Wichmann
On 06/20/2018 02:04 PM, Glenn Schultz wrote: > All, > > I have a pandas dataframe and a predict result (numpy array) of a > classifier [[0,1],[1,0]].  What I would like to do is as the positive to > the pandas dataframe.  I use predict[:,1] to slice the postive from > numpy which gives me a row

Re: [Tutor] Parsing and collecting keywords from a webpage

2018-06-21 Thread Peter Otten
Daniel Bosah wrote: > new_list = [x.encode('latin-1') for x in sorted(paul)] I don't see why you would need bytes > search = "(" + b"|".join(new_list).decode() + ")" + "" #re.complie needs when your next step is to decode it. I'm not sure why it even works as the default encoding is usually

Re: [Tutor] Parsing and collecting keywords from a webpage

2018-06-21 Thread Alan Gauld via Tutor
On 20/06/18 20:32, Daniel Bosah wrote: > reg = pattern.findall(str(soup)) > > for i in reg: > if i in reg and paul: # this loop checks to see if elements are in > both the regexed parsed list and the list. No it doesn't. It checks if i is in reg and if paul is non empty - which it