Skip to content

Instantly share code, notes, and snippets.

@hiepph
Created August 21, 2020 08:02
Show Gist options
  • Save hiepph/945b0f26fae4ff011d3818652ef1d468 to your computer and use it in GitHub Desktop.
Save hiepph/945b0f26fae4ff011d3818652ef1d468 to your computer and use it in GitHub Desktop.
Get set of unique characters from a list of strings
import dask.bag as db
labels = ["abc", "abd", "bcd"]
b = db.from_sequence(labels)
def join_2_set(a, b):
return set(a) | set(b)
char_sets = b.map(set).fold(join_2_set).compute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment