Terrible Trends
Quick visual analysis of two Google Trends queries for the United States looking at searches for “Can’t Pay” and “Help With” for automobile loans, mortgages, and credit cards.
It’s also an example of how to do “surgery” and {tidyverse}-like operations on CSV files with DuckDB (scroll to the end).
- Preview is at https://rud.is/obs/terrible-trends.
- Source is on Codeberg.
UNPIVOT (
FROM (
FROM read_csv_auto('cant-pay.csv', skip := 3, columns = { -- skip intro and ugh header
'month':'TEXT',
'mortgage': 'INT',
'credit_card': 'INT',
'car_loan': 'INT'
})
SELECT
(month || '-01')::DATE AS month, -- Plot wld have handled this OK but I like to be explicit
'Can''t Pay' AS group,
*
EXCLUDE month
UNION
FROM read_csv_auto('help-with.csv', skip := 3, columns = { -- skip intro and ugh header
'month':'TEXT',
'mortgage': 'INT',
'credit_card': 'INT',
'car_loan': 'INT'
})
SELECT
(month || '-01')::DATE AS month, -- Plot wld have handled this OK but I like to be explicit
'Help With' AS group,
*
EXCLUDE month
)
)
ON COLUMNS(* EXCLUDE (month, "group"))
ORDER BY month