Skip to content

Instantly share code, notes, and snippets.

@quanon
Last active September 24, 2024 22:40
Show Gist options
  • Save quanon/d83fae1514c9f6849f4c9206e97314b0 to your computer and use it in GitHub Desktop.
Save quanon/d83fae1514c9f6849f4c9206e97314b0 to your computer and use it in GitHub Desktop.
Count yo-yos by brand
# Count the yo-yos I have by brand and get the top 5 brands.
# Use the CSV output from Notion's database to tally.
require 'csv'
rows = CSV.read(Pathname(Dir.home).join('Downloads/my_yoyos.csv'))
resutls = rows.slice(1..).map { _1[1].split(/,\s*/) }.flatten.tally
resutls.sort_by { -_2 }.first(5).to_h
@quanon
Copy link
Author

quanon commented Sep 24, 2024

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment