Unit 28Treating Arrays as Sets

In some cases, the order of items in an array is less important than the array composition—whether a particular item is in the array or not, or what kind of items are in the array. numpy knows how to treat arrays as mathematical sets.

The function unique(x) returns an array of all unique elements of x. It’s a great substitute for the Counter module (which you looked at in Unit 7, Counting with Counters), but it doesn’t really count the occurrences.

We all know that bioinformatics is the best thing since data science (which is the best thing since sliced bread). Bioinformatics deals with genome sequencing—figuring out the order of DNA nucleotides. Let’s do some pseudo bioinformatics now and find out what kinds ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.