Datasets:
File size: 4,188 Bytes
f9b9d7d 88822ca f9b9d7d 88822ca 561b916 88822ca 561b916 88822ca 561b916 88822ca 561b916 88822ca | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ---
license: odc-by
language: [en]
pretty_name: Hacker News items (parquet, monthly)
size_categories: [10M<n<100M]
task_categories: [text-generation, text-classification, feature-extraction]
tags: [hacker-news, forum, parquet, comments, live-updated]
configs:
- config_name: default
data_files:
- split: train
path: data/*/*/data.parquet
---
# Hacker News items, monthly parquet
Every Hacker News item (stories, comments, jobs, polls, poll options) from 2007-02 to the present, fetched from the official Firebase API. About **50M items in 7.3 GiB** (zstd level 15), one parquet file per month at `data/year=YYYY/month=M/data.parquet`, each sorted by `id`. Updated roughly weekly.
Companion dataset with LLM-judge labels per comment: `adhikasp/hackernews-annotation` (joins on `id`).
## Schema
| column | type | notes |
|---|---|---|
| `id` | int64 | HN item id, unique |
| `time` | timestamp | **naive timestamp in UTC+7** (matches the original dataset this one continues); files are partitioned by it |
| `type` | string | `story`, `comment`, `job`, `poll`, `pollopt` |
| `by` | string | author username (null if deleted) |
| `title`, `url`, `text` | string | text is HTML as served by the API |
| `score`, `descendants` | double | stories/polls |
| `parent` | double | comments and poll options |
| `poll` | double | for poll options |
| `parts`, `kids` | list<int64> | poll options, child comment ids |
| `dead`, `deleted` | bool | null when false |
Counts (2026-11-28): comments 44.06M, stories 6.36M, jobs 18k, polls 2.3k, poll options 16k.
## Quick start
Pick whichever fits. Each month is one file (max ~97 MB), so filter by path to read less.
**DuckDB (no download, reads straight from the Hub)**
```python
import duckdb
duckdb.sql("""
select by, count(*) n from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
where type='comment' group by 1 order by n desc limit 10
""").show()
```
**DuckDB CLI**
```sql
INSTALL httpfs; LOAD httpfs;
SELECT title, score FROM 'hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet'
WHERE type='story' ORDER BY score DESC LIMIT 10;
```
**Polars (lazy, only fetches what it needs)**
```python
import polars as pl
lf = pl.scan_parquet("hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet")
lf.filter(pl.col("type") == "story").select("title", "score").sort("score", descending=True).head(10).collect()
```
**pandas**
```python
import pandas as pd
df = pd.read_parquet("hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet")
```
**Hugging Face `datasets` (streaming, nothing stored)**
```python
from datasets import load_dataset
ds = load_dataset("adhikasp/hackernews", split="train", streaming=True)
for row in ds.take(3): print(row["id"], row["type"], row["title"])
```
**Download a slice**
```bash
hf download adhikasp/hackernews --repo-type dataset --include "data/year=2025/*" --local-dir hn
# or one month with plain curl
curl -LO "https://huggingface.co/datasets/adhikasp/hackernews/resolve/main/data/year=2026/month=11/data.parquet"
```
**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'")`.
Mirror without the Hub: `https://hacker-news.adhikasp.id/year=2025/month=1/data.parquet` (same files).
### Handy queries
```sql
-- most-discussed stories of a month
select title, score, descendants from 'hf://datasets/adhikasp/hackernews/data/year=2025/month=1/data.parquet'
where type='story' order by descendants desc limit 10;
-- comments per month in a year
select month, count(*) from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
where type='comment' group by 1 order by 1;
```
## Notes
- Items fetched live can still change (scores, new kids, deletions). The current and previous month are refreshed on each update; older months are stable.
- Gaps in `id` are items the API returns as null (never existed or purged).
- Hacker News content belongs to its authors and Y Combinator; this is a mirror of what the public API serves.
Source/fetcher: `hn-data-fetcher` (PyPI, GitHub `adhikasp/hn-data-fetcher`).
|