philyoon / pyp

Automatically exported from code.google.com/p/pyp
0 stars 0 forks source link

expanding pp.uniq features #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
currently pp.uniq() can only eliminate duplicates as a whole.  But I think it 
would be cooler if you give it a (w[-1]) so that it would eliminate (or merge 
entries) based on a single column, rather than the whole line. 

Original issue reported on code.google.com by davidlee...@gmail.com on 26 Nov 2012 at 10:17

GoogleCodeExporter commented 9 years ago
interesting idea...if you have the time, I can help you rewrite the uniq 
function to cover this.

Original comment by tobyro...@gmail.com on 1 Feb 2013 at 5:34

GoogleCodeExporter commented 9 years ago
I've finally got a few cycles, so I was taking a look at the underpinnings.  
But after thinking about this, I realized that there is a workaround...

If in the case above you re.replace w[-1] you can remove it then pipe it to 
pp.uniq() which will then provide the uniq set.  If you need to merge entries, 
you can again pipe it to pp.oneline().  I think.

Its been so long now I forgot the original data set I used that warranted this 
feature.  If I come across it again I'll be sure to add it myself!

I also realized that to implement w[-1] into the pp class would be problematic 
no? Since that refers to a method elsewhere and power pyper does not recognize 
it.  

Original comment by davidlee...@gmail.com on 2 Apr 2014 at 7:02