You have different pieces in play. You should find out where the error is. Is find_dupl() broken, or is it okay and the problem is in duplication_pkg_count()?
First thing is that find_dupl looks odd to me. You're going to the trouble of making a nice Counter object, but then when you're done you're looping over it constantly. Much better it to just call into it.
I think instead of
First thing is that find_dupl looks odd to me. You're going to the trouble of making a nice Counter object, but then when you're done you're looping over it constantly. Much better it to just call into it.
I think instead of
return [[s[index] for index, seq in enumerate(tcpSeq) if seq == key] for (key, value) in counter.items() if value > 1]you could just do:
return [s for s in tcpSeq if counter[s] > 1]Also, maybe instead of 'counter' you could use a name like 'seq_count'.