Skip to content

Commit

Permalink
🎨 group_by() use NamedTuple.
Browse files Browse the repository at this point in the history
  • Loading branch information
mokeyish committed Sep 7, 2023
1 parent 1357200 commit e705eca
Show file tree
Hide file tree
Showing 5 changed files with 6,676 additions and 6,581 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ it(text).map(str.upper).to_list()


words = 'I dont want to believe I want to know'.split()
it(words).group_by(lambda x: x).map(lambda w: (w[0], w[1].count())).to_list()
it(words).group_by(lambda x: x).map(lambda g: (g.key, g.values.count())).to_list()
# [('I', 2), ('dont', 1), ('want', 2), ('to', 2), ('believe', 1), ('know', 1)]


Expand Down
Loading

0 comments on commit e705eca

Please sign in to comment.