adhikasp commited on
Commit
561b916
·
verified ·
1 Parent(s): 88822ca

README: quick starts, drop open-index mention

Browse files
Files changed (1) hide show
  1. README.md +63 -4
README.md CHANGED
@@ -35,19 +35,78 @@ Companion dataset with LLM-judge labels per comment: `adhikasp/hackernews-annota
35
 
36
  Counts (2026-11-28): comments 44.06M, stories 6.36M, jobs 18k, polls 2.3k, poll options 16k.
37
 
38
- ## Use
 
 
 
 
39
 
40
  ```python
41
  import duckdb
42
- duckdb.sql("select count(*) from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet' where type='comment'")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ```
44
 
45
- Each monthly file has a single row group, so a query reads a whole file (max ~97 MB); filter by path to read less.
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  ## Notes
48
 
49
  - Items fetched live can still change (scores, new kids, deletions). The current and previous month are refreshed on each update; older months are stable.
50
  - Gaps in `id` are items the API returns as null (never existed or purged).
51
- - Hacker News content belongs to its authors and Y Combinator; this is a mirror of what the public API serves. For a full-archive alternative updated every 5 minutes see `open-index/hacker-news`.
52
 
53
  Source/fetcher: `hn-data-fetcher` (PyPI, GitHub `adhikasp/hn-data-fetcher`).
 
35
 
36
  Counts (2026-11-28): comments 44.06M, stories 6.36M, jobs 18k, polls 2.3k, poll options 16k.
37
 
38
+ ## Quick start
39
+
40
+ Pick whichever fits. Each month is one file (max ~97 MB), so filter by path to read less.
41
+
42
+ **DuckDB (no download, reads straight from the Hub)**
43
 
44
  ```python
45
  import duckdb
46
+ duckdb.sql("""
47
+ select by, count(*) n from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
48
+ where type='comment' group by 1 order by n desc limit 10
49
+ """).show()
50
+ ```
51
+
52
+ **DuckDB CLI**
53
+
54
+ ```sql
55
+ INSTALL httpfs; LOAD httpfs;
56
+ SELECT title, score FROM 'hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet'
57
+ WHERE type='story' ORDER BY score DESC LIMIT 10;
58
+ ```
59
+
60
+ **Polars (lazy, only fetches what it needs)**
61
+
62
+ ```python
63
+ import polars as pl
64
+ lf = pl.scan_parquet("hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet")
65
+ lf.filter(pl.col("type") == "story").select("title", "score").sort("score", descending=True).head(10).collect()
66
+ ```
67
+
68
+ **pandas**
69
+
70
+ ```python
71
+ import pandas as pd
72
+ df = pd.read_parquet("hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet")
73
+ ```
74
+
75
+ **Hugging Face `datasets` (streaming, nothing stored)**
76
+
77
+ ```python
78
+ from datasets import load_dataset
79
+ ds = load_dataset("adhikasp/hackernews", split="train", streaming=True)
80
+ for row in ds.take(3): print(row["id"], row["type"], row["title"])
81
+ ```
82
+
83
+ **Download a slice**
84
+
85
+ ```bash
86
+ hf download adhikasp/hackernews --repo-type dataset --include "data/year=2025/*" --local-dir hn
87
+ # or one month with plain curl
88
+ curl -LO "https://huggingface.co/datasets/adhikasp/hackernews/resolve/main/data/year=2026/month=11/data.parquet"
89
  ```
90
 
91
+ **Whole dataset** (7.3 GiB): `hf download adhikasp/hackernews --repo-type dataset --local-dir hn`, then `duckdb.sql("select count(*) from 'hn/data/*/*/data.parquet'")`.
92
+
93
+ Mirror without the Hub: `https://hacker-news.adhikasp.id/year=2025/month=1/data.parquet` (same files).
94
+
95
+ ### Handy queries
96
+
97
+ ```sql
98
+ -- most-discussed stories of a month
99
+ select title, score, descendants from 'hf://datasets/adhikasp/hackernews/data/year=2025/month=1/data.parquet'
100
+ where type='story' order by descendants desc limit 10;
101
+ -- comments per month in a year
102
+ select month, count(*) from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
103
+ where type='comment' group by 1 order by 1;
104
+ ```
105
 
106
  ## Notes
107
 
108
  - Items fetched live can still change (scores, new kids, deletions). The current and previous month are refreshed on each update; older months are stable.
109
  - Gaps in `id` are items the API returns as null (never existed or purged).
110
+ - Hacker News content belongs to its authors and Y Combinator; this is a mirror of what the public API serves.
111
 
112
  Source/fetcher: `hn-data-fetcher` (PyPI, GitHub `adhikasp/hn-data-fetcher`).