-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcsv_explorer.rb
More file actions
executable file
·51 lines (39 loc) · 1020 Bytes
/
Copy pathcsv_explorer.rb
File metadata and controls
executable file
·51 lines (39 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/recurgent"
MODEL = Agent::DEFAULT_MODEL
FILE = File.expand_path("data/sales_2024.csv", __dir__)
puts "=== CSV Explorer ==="
puts "Model: #{MODEL}"
puts "File: #{FILE}"
puts
puts "No CSV library. No date parser. No charting gem."
puts "Just a name and a file path. The LLM figures out the rest."
puts
csv = Agent.for(
"CSV data analyst for #{FILE} — the file has messy dates (mixed formats), missing values, and notes",
model: MODEL
)
puts "-> csv.load"
csv.load
puts
puts "-> csv.row_count"
puts csv.row_count
puts
puts "-> csv.column_names"
puts csv.column_names.inspect
puts
puts "-> csv.total_revenue"
puts csv.total_revenue
puts
puts "-> csv.top_sellers(n: 3)"
puts csv.top_sellers(n: 3).inspect
puts
puts "-> csv.revenue_by_category"
puts csv.revenue_by_category.inspect
puts
puts "-> csv.revenue_by_quarter"
puts csv.revenue_by_quarter.inspect
puts
puts "-> csv.data_quality_report"
puts csv.data_quality_report.inspect