subset
Subsetting a 2D numpy array
You’ve gotten a handful of nice examples of how to do what you want. However, it’s also useful to understand the what’s happening and why things work the way they do. There are a few simple rules that will help you in the future. There’s a big difference between “fancy” indexing (i.e. using a list/sequence) … Read more
Creating subset of a Set in Java
In Guava: Set<Integer> subset = ImmutableSet.copyOf(Iterables.limit(set, 20)); Note that Iterables.limit() is evaluated lazily, so only one extra collection is created.