Publish original subreddit directory as lossless Parquet with documentation
Browse files- README.md +94 -0
- conversion-manifest.json +69 -0
- convert.py +96 -0
- data/train-00000-of-00001.parquet +3 -0
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Subreddits Directory
|
| 3 |
+
license: other
|
| 4 |
+
license_name: reddit-api
|
| 5 |
+
license_link: https://redditinc.com/policies/data-api-terms
|
| 6 |
+
size_categories:
|
| 7 |
+
- 100K<n<1M
|
| 8 |
+
tags:
|
| 9 |
+
- reddit
|
| 10 |
+
- subreddits
|
| 11 |
+
- community-metadata
|
| 12 |
+
- tabular
|
| 13 |
+
- historical
|
| 14 |
+
configs:
|
| 15 |
+
- config_name: default
|
| 16 |
+
data_files:
|
| 17 |
+
- split: train
|
| 18 |
+
path: data/*.parquet
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# Subreddits Directory
|
| 22 |
+
|
| 23 |
+
A Parquet edition of Hashir Omer's [SubReddits Directory on Kaggle](https://www.kaggle.com/datasets/hashiromer/subreddits-directory), published under SemVec.
|
| 24 |
+
|
| 25 |
+
The dataset contains **395,018 rows and 12 columns** of subreddit names, descriptions, member counts, and other community metadata. The original Kaggle CSV is `subreddits_with_details.csv`; Kaggle lists its last update as May 26, 2025. This Parquet edition was prepared on October 17, 2026.
|
| 26 |
+
|
| 27 |
+
**The metadata has not been refreshed.** The publication date of this repository is not the collection date. Names, descriptions, member counts, rules, availability, and other values describe the source data as previously collected. This is not a verified directory of every currently existing subreddit.
|
| 28 |
+
|
| 29 |
+
## Data and preservation
|
| 30 |
+
|
| 31 |
+
The single file `data/train-00000-of-00001.parquet` uses Zstandard compression and is 183,178,103 bytes (approximately 183 MB). The `train` split contains the entire source table; it is a loading convention, not an assignment of this data to model training or a train/test partition.
|
| 32 |
+
|
| 33 |
+
All original column names, parsed cell values, row order, and column order are preserved. No rows were filtered, deduplicated, added, or reordered. No descriptions were rewritten, combined, trimmed, or filled in. Existing rules and other auxiliary columns are retained.
|
| 34 |
+
|
| 35 |
+
Every column is stored as a **string**, including counts, booleans, and timestamps. This deliberately avoids changing numeric spellings, boolean spellings, or timestamp representations during CSV type inference. Empty CSV cells remain empty strings, not nulls. CSV quoting and delimiters are serialization details and are replaced by Parquet encoding.
|
| 36 |
+
|
| 37 |
+
The conversion was verified by reading the original CSV again and comparing **every cell of every row** with the Parquet output. `conversion-manifest.json` records the result, file SHA-256 checksums, schema, and empty-string counts. The original CSV remains the provenance source; it is not duplicated in this repository.
|
| 38 |
+
|
| 39 |
+
## Columns
|
| 40 |
+
|
| 41 |
+
| Column | Meaning | Empty cells |
|
| 42 |
+
|---|---|---:|
|
| 43 |
+
| `title` | Subreddit title supplied by the source. | 18 |
|
| 44 |
+
| `description` | Longer subreddit description/sidebar text supplied by the source. | 161,178 |
|
| 45 |
+
| `display_name` | Subreddit display name supplied by the source. | 1 |
|
| 46 |
+
| `created_utc` | Community creation-time value in the source's original representation. | 0 |
|
| 47 |
+
| `over18` | Source adult-content/NSFW flag, retained as text. | 0 |
|
| 48 |
+
| `url` | Source community URL or relative Reddit path. | 0 |
|
| 49 |
+
| `subscribers` | Subscriber/member count at source collection time, retained as text. | 0 |
|
| 50 |
+
| `public_description` | Short public subreddit description supplied by the source. | 54,126 |
|
| 51 |
+
| `subreddit` | Subreddit name supplied by the source. | 0 |
|
| 52 |
+
| `retrieved_on` | Source retrieval-time value, when provided; retained verbatim. | 259,611 |
|
| 53 |
+
| `rules_markdown` | Source community rules in Markdown, when provided. | 259,611 |
|
| 54 |
+
| `descp` | Auxiliary description field already present in the source. Its original construction is undocumented; it is preserved without reinterpretation. | 0 |
|
| 55 |
+
|
| 56 |
+
## Load with Hugging Face Datasets
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from datasets import load_dataset
|
| 60 |
+
|
| 61 |
+
dataset = load_dataset("semvec/subreddits-directory", split="train")
|
| 62 |
+
print(dataset.column_names)
|
| 63 |
+
print(dataset[0])
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
For incremental reading:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
dataset = load_dataset(
|
| 70 |
+
"semvec/subreddits-directory", split="train", streaming=True
|
| 71 |
+
)
|
| 72 |
+
row = next(iter(dataset))
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Consumers can explicitly parse numeric or date columns for their own analysis. No such coercion is applied to the published data.
|
| 76 |
+
|
| 77 |
+
## Reproduce the conversion
|
| 78 |
+
|
| 79 |
+
Install the Kaggle CLI and PyArrow. Authenticate to Kaggle with an account that can access the source dataset, then run:
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
kaggle datasets download hashiromer/subreddits-directory --unzip -p source
|
| 83 |
+
python convert.py source/subreddits_with_details.csv output
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
The script writes Parquet and a validation manifest. It makes no Reddit requests. File-level Parquet checksums can vary with dependency versions; `conversion-manifest.json` records the version used for this edition. The source CSV SHA-256 identifies the exact input used here.
|
| 87 |
+
|
| 88 |
+
## Source and usage terms
|
| 89 |
+
|
| 90 |
+
Source: [hashiromer/subreddits-directory](https://www.kaggle.com/datasets/hashiromer/subreddits-directory), titled **SubReddits Directory**. Access to the original Kaggle dataset may require permission from its owner. The source metadata does not document its full collection methodology or upstream lineage; this edition does not assert an Arctic Shift origin.
|
| 91 |
+
|
| 92 |
+
Kaggle labels the source license **`reddit-api`**. This repository carries forward that designation and links to [Reddit's Data API Terms](https://redditinc.com/policies/data-api-terms); it does not relicense the underlying content under an open-source or Creative Commons license. Public availability of this repository does not grant additional rights to the source material.
|
| 93 |
+
|
| 94 |
+
Descriptions and rules are user-generated text and may contain offensive or adult content. Source flags and metadata have not been independently validated. Missing fields, duplicate records, and any source inconsistencies are preserved.
|
conversion-manifest.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source": "https://www.kaggle.com/datasets/hashiromer/subreddits-directory",
|
| 3 |
+
"source_filename": "subreddits_with_details.csv",
|
| 4 |
+
"source_bytes": 397566769,
|
| 5 |
+
"source_sha256": "a449ece09a2115e8eba670a0d00cc0cca734b4b3d85d289dcd5f6f2becd833b1",
|
| 6 |
+
"source_license_identifier": "reddit-api",
|
| 7 |
+
"parquet_file": "data/train-00000-of-00001.parquet",
|
| 8 |
+
"parquet_bytes": 183178103,
|
| 9 |
+
"parquet_sha256": "20cd09b4fed1c12bd316574c43a0ebaae0beb27b75c74d58c1057eb2104a0746",
|
| 10 |
+
"row_count": 395018,
|
| 11 |
+
"column_count": 12,
|
| 12 |
+
"columns": [
|
| 13 |
+
"title",
|
| 14 |
+
"description",
|
| 15 |
+
"display_name",
|
| 16 |
+
"created_utc",
|
| 17 |
+
"over18",
|
| 18 |
+
"url",
|
| 19 |
+
"subscribers",
|
| 20 |
+
"public_description",
|
| 21 |
+
"subreddit",
|
| 22 |
+
"retrieved_on",
|
| 23 |
+
"rules_markdown",
|
| 24 |
+
"descp"
|
| 25 |
+
],
|
| 26 |
+
"column_types": {
|
| 27 |
+
"title": "string",
|
| 28 |
+
"description": "string",
|
| 29 |
+
"display_name": "string",
|
| 30 |
+
"created_utc": "string",
|
| 31 |
+
"over18": "string",
|
| 32 |
+
"url": "string",
|
| 33 |
+
"subscribers": "string",
|
| 34 |
+
"public_description": "string",
|
| 35 |
+
"subreddit": "string",
|
| 36 |
+
"retrieved_on": "string",
|
| 37 |
+
"rules_markdown": "string",
|
| 38 |
+
"descp": "string"
|
| 39 |
+
},
|
| 40 |
+
"empty_string_counts": {
|
| 41 |
+
"title": 18,
|
| 42 |
+
"description": 161178,
|
| 43 |
+
"display_name": 1,
|
| 44 |
+
"created_utc": 0,
|
| 45 |
+
"over18": 0,
|
| 46 |
+
"url": 0,
|
| 47 |
+
"subscribers": 0,
|
| 48 |
+
"public_description": 54126,
|
| 49 |
+
"subreddit": 0,
|
| 50 |
+
"retrieved_on": 259611,
|
| 51 |
+
"rules_markdown": 259611,
|
| 52 |
+
"descp": 0
|
| 53 |
+
},
|
| 54 |
+
"validation": {
|
| 55 |
+
"method": "Full row-by-row and cell-by-cell comparison with parsed source CSV",
|
| 56 |
+
"verified_rows": 395018,
|
| 57 |
+
"all_values_identical": true,
|
| 58 |
+
"row_order_preserved": true,
|
| 59 |
+
"column_order_preserved": true
|
| 60 |
+
},
|
| 61 |
+
"conversion": {
|
| 62 |
+
"pyarrow_version": "26.0.0",
|
| 63 |
+
"compression": "zstd",
|
| 64 |
+
"csv_encoding": "utf-8",
|
| 65 |
+
"type_inference": false,
|
| 66 |
+
"empty_fields": "Preserved as empty strings; no null inference",
|
| 67 |
+
"metadata_refreshed": false
|
| 68 |
+
}
|
| 69 |
+
}
|
convert.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Losslessly convert the source CSV's parsed cells to Parquet.
|
| 2 |
+
|
| 3 |
+
Usage: python convert.py path/to/subreddits_with_details.csv output_directory
|
| 4 |
+
Requires pyarrow. No Reddit requests, cleanup, filtering, or type inference.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import csv
|
| 8 |
+
import hashlib
|
| 9 |
+
import itertools
|
| 10 |
+
import json
|
| 11 |
+
import sys
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
import pyarrow as pa
|
| 15 |
+
import pyarrow.parquet as pq
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def sha256(path):
|
| 19 |
+
with path.open("rb") as stream:
|
| 20 |
+
return hashlib.file_digest(stream, "sha256").hexdigest()
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def convert(source, output):
|
| 24 |
+
csv.field_size_limit(sys.maxsize)
|
| 25 |
+
output.mkdir(parents=True, exist_ok=True)
|
| 26 |
+
target = output / "data" / "train-00000-of-00001.parquet"
|
| 27 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 28 |
+
row_count = 0
|
| 29 |
+
with source.open(encoding="utf-8", newline="") as stream:
|
| 30 |
+
reader = csv.reader(stream, strict=True)
|
| 31 |
+
columns = next(reader)
|
| 32 |
+
assert len(set(columns)) == len(columns), "Duplicate source column names"
|
| 33 |
+
schema = pa.schema([(name, pa.string()) for name in columns])
|
| 34 |
+
empty_counts = dict.fromkeys(columns, 0)
|
| 35 |
+
with pq.ParquetWriter(target, schema, compression="zstd") as writer:
|
| 36 |
+
while rows := list(itertools.islice(reader, 5000)):
|
| 37 |
+
assert all(len(row) == len(columns) for row in rows), "Ragged CSV row"
|
| 38 |
+
arrays = []
|
| 39 |
+
for index, name in enumerate(columns):
|
| 40 |
+
values = [row[index] for row in rows]
|
| 41 |
+
empty_counts[name] += values.count("")
|
| 42 |
+
arrays.append(pa.array(values, type=pa.string()))
|
| 43 |
+
writer.write_table(pa.Table.from_arrays(arrays, schema=schema))
|
| 44 |
+
row_count += len(rows)
|
| 45 |
+
|
| 46 |
+
# Independently read the original CSV again and compare every output cell.
|
| 47 |
+
verified_rows = 0
|
| 48 |
+
with source.open(encoding="utf-8", newline="") as stream:
|
| 49 |
+
reader = csv.reader(stream, strict=True)
|
| 50 |
+
assert next(reader) == columns
|
| 51 |
+
for batch in pq.ParquetFile(target).iter_batches(batch_size=5000):
|
| 52 |
+
assert batch.schema.names == columns
|
| 53 |
+
for row in zip(*(column.to_pylist() for column in batch.columns)):
|
| 54 |
+
assert list(row) == next(reader), f"Mismatch at row {verified_rows}"
|
| 55 |
+
verified_rows += 1
|
| 56 |
+
assert next(reader, None) is None, "Source has additional rows"
|
| 57 |
+
assert verified_rows == row_count
|
| 58 |
+
|
| 59 |
+
manifest = {
|
| 60 |
+
"source": "https://www.kaggle.com/datasets/hashiromer/subreddits-directory",
|
| 61 |
+
"source_filename": source.name,
|
| 62 |
+
"source_bytes": source.stat().st_size,
|
| 63 |
+
"source_sha256": sha256(source),
|
| 64 |
+
"source_license_identifier": "reddit-api",
|
| 65 |
+
"parquet_file": target.relative_to(output).as_posix(),
|
| 66 |
+
"parquet_bytes": target.stat().st_size,
|
| 67 |
+
"parquet_sha256": sha256(target),
|
| 68 |
+
"row_count": row_count,
|
| 69 |
+
"column_count": len(columns),
|
| 70 |
+
"columns": columns,
|
| 71 |
+
"column_types": dict.fromkeys(columns, "string"),
|
| 72 |
+
"empty_string_counts": empty_counts,
|
| 73 |
+
"validation": {
|
| 74 |
+
"method": "Full row-by-row and cell-by-cell comparison with parsed source CSV",
|
| 75 |
+
"verified_rows": verified_rows,
|
| 76 |
+
"all_values_identical": True,
|
| 77 |
+
"row_order_preserved": True,
|
| 78 |
+
"column_order_preserved": True,
|
| 79 |
+
},
|
| 80 |
+
"conversion": {
|
| 81 |
+
"pyarrow_version": pa.__version__,
|
| 82 |
+
"compression": "zstd",
|
| 83 |
+
"csv_encoding": "utf-8",
|
| 84 |
+
"type_inference": False,
|
| 85 |
+
"empty_fields": "Preserved as empty strings; no null inference",
|
| 86 |
+
"metadata_refreshed": False,
|
| 87 |
+
},
|
| 88 |
+
}
|
| 89 |
+
(output / "conversion-manifest.json").write_text(
|
| 90 |
+
json.dumps(manifest, indent=2) + "\n", encoding="utf-8"
|
| 91 |
+
)
|
| 92 |
+
print(json.dumps(manifest, indent=2))
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
if __name__ == "__main__":
|
| 96 |
+
convert(Path(sys.argv[1]), Path(sys.argv[2]))
|
data/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20cd09b4fed1c12bd316574c43a0ebaae0beb27b75c74d58c1057eb2104a0746
|
| 3 |
+
size 183178103
|