Omarrran commited on
Commit
0293728
Β·
verified Β·
1 Parent(s): 8d09cde

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +323 -0
README.md ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pretty_name: "StackOverflow-778K: Multi-Year Developer Q&A Dataset"
6
+ size_categories:
7
+ - 100K<n<1M
8
+ task_categories:
9
+ - text-classification
10
+ - question-answering
11
+ - text-generation
12
+ - feature-extraction
13
+ - zero-shot-classification
14
+ tags:
15
+ - stackoverflow
16
+ - code
17
+ - nlp
18
+ - question-answering
19
+ - programming
20
+ - python
21
+ - javascript
22
+ - java
23
+ - developer
24
+ - community-qa
25
+ - html
26
+ - tags
27
+ configs:
28
+ - config_name: full
29
+ data_files:
30
+ - split: train
31
+ path: data/stackoverflow_778k_full.jsonl
32
+ - config_name: unanswered
33
+ data_files:
34
+ - split: train
35
+ path: data/stackoverflow_unanswered.jsonl
36
+ - config_name: with_code
37
+ data_files:
38
+ - split: train
39
+ path: data/stackoverflow_with_code.jsonl
40
+ - config_name: high_quality
41
+ data_files:
42
+ - split: train
43
+ path: data/stackoverflow_high_quality.jsonl
44
+ - config_name: python
45
+ data_files:
46
+ - split: train
47
+ path: data/stackoverflow_python.jsonl
48
+ - config_name: javascript
49
+ data_files:
50
+ - split: train
51
+ path: data/stackoverflow_javascript.jsonl
52
+ - config_name: java
53
+ data_files:
54
+ - split: train
55
+ path: data/stackoverflow_java.jsonl
56
+ - config_name: csharp
57
+ data_files:
58
+ - split: train
59
+ path: data/stackoverflow_csharp.jsonl
60
+ - config_name: android
61
+ data_files:
62
+ - split: train
63
+ path: data/stackoverflow_android.jsonl
64
+ ---
65
+
66
+ # πŸ’» StackOverflow-778K: Multi-Year Developer Q&A Dataset
67
+
68
+ ## Dataset Summary
69
+
70
+ A large-scale Stack Overflow question dataset containing **778,929 unique
71
+ questions** sampled across **7 years (2015–2022)**. Each question includes the
72
+ raw HTML body, plain-text version, tags, score, view count, answer count, and
73
+ a rich set of derived features for immediate ML use.
74
+
75
+ Collected across **8 sampling runs** on Feb 27 2026, deduplicated to
76
+ **778,929 unique questions** with only 2 duplicates removed.
77
+
78
+ ---
79
+
80
+ ## πŸ“ Files in This Dataset
81
+
82
+ | File | Format | Rows | Description |
83
+ |------|--------|------|-------------|
84
+ | stackoverflow_778k_full.csv | CSV | 778,929 | Complete dataset |
85
+ | stackoverflow_unanswered.csv | CSV | 224,733 | Questions with 0 answers |
86
+ | stackoverflow_with_code.csv | CSV | 595,679 | Questions containing code blocks |
87
+ | stackoverflow_high_quality.csv | CSV | 20,205 | Score β‰₯ 5 and answered |
88
+ | stackoverflow_python.csv | CSV | 107,083 | Python-tagged questions |
89
+ | stackoverflow_javascript.csv | CSV | 87,367 | JavaScript-tagged questions |
90
+ | stackoverflow_java.csv | CSV | 54,077 | Java-tagged questions |
91
+ | stackoverflow_csharp.csv | CSV | 40,420 | C#-tagged questions |
92
+ | stackoverflow_android.csv | CSV | 42,004 | Android-tagged questions |
93
+ | *.jsonl versions | JSONL | same | HuggingFace-native format for all above |
94
+
95
+ ---
96
+
97
+ ## πŸ—οΈ Schema Reference
98
+
99
+ | Column | Type | Description |
100
+ |--------|------|-------------|
101
+ | id | int64 | Unique Stack Overflow question ID |
102
+ | title | string | Question title |
103
+ | question_body | string | Raw HTML body (includes `<pre><code>` blocks) |
104
+ | body_text | string | Plain text body (HTML stripped, code replaced with [CODE]) |
105
+ | tags | string | Pipe-separated tags e.g. `python\|pandas\|dataframe` |
106
+ | score | int64 | Net upvotes (can be negative) |
107
+ | creation_date | string | ISO 8601 UTC creation timestamp |
108
+ | year | int32 | Year extracted from creation_date |
109
+ | month | int32 | Month (1–12) |
110
+ | hour | int32 | Hour of day (0–23, UTC) |
111
+ | dayofweek | int32 | Day of week (0=Monday, 6=Sunday) |
112
+ | view_count | int64 | Total question views |
113
+ | answer_count | int64 | Number of answers received |
114
+ | body_len | int64 | Plain text body character length |
115
+ | title_len | int64 | Title character length |
116
+ | tag_count | int64 | Number of tags (1–5) |
117
+ | code_block_cnt | int64 | Number of `<pre>` code blocks in body |
118
+ | has_code | bool | True if question contains at least one code block |
119
+ | is_unanswered | bool | True if answer_count == 0 |
120
+ | is_popular | bool | True if view_count > 95th percentile (~2,599) |
121
+ | is_viral | bool | True if view_count > 99th percentile (~11,513) |
122
+ | is_highly_voted | bool | True if score >= 10 |
123
+ | is_negative | bool | True if score < 0 |
124
+ | score_bucket | string | "negative" / "zero" / "low" / "medium" / "high" |
125
+
126
+ ---
127
+
128
+ ## πŸ“ˆ Dataset Statistics
129
+
130
+ ### Overview
131
+ - **Total questions**: 778,929
132
+ - **Date range**: 2015-02-14 β†’ 2022-09-25
133
+ - **Missing years**: 2019, 2021 (sampling gaps)
134
+ - **Unique tags**: 41,754
135
+ - **Zero nulls** in all core columns (2 questions have empty tags)
136
+
137
+ ### Score Distribution
138
+ - Mean: 0.69 | Median: 0 | Std: 4.77
139
+ - Range: -27 to 1,061
140
+ - Negative score: 63,415 (8.14%)
141
+ - Zero score: 461,977 (59.31%) β€” majority never upvoted
142
+ - Score β‰₯ 10: 7,431 (0.95%)
143
+ - Score β‰₯ 100: 246 (0.032%)
144
+
145
+ ### View Count Distribution
146
+ - Mean: 794 | Median: 66 | P95: 2,599 | P99: 11,513
147
+ - Max: 915,870 views
148
+ - Popular (>P95): 38,944 (5.00%)
149
+ - Viral (>P99): 7,789 (1.00%)
150
+
151
+ ### Answer Count
152
+ - Unanswered: 224,733 (28.85%)
153
+ - 1 answer: 387,399 (49.73%)
154
+ - 2+ answers: 166,797 (21.42%)
155
+ - Max answers on a single question: 36
156
+
157
+ ### Question Body
158
+ - Has code block: 595,679 (76.47%)
159
+ - Avg code blocks per question: 1.56
160
+ - Avg body length: 557 chars | Median: 447 chars
161
+ - Avg title length: 59 chars
162
+
163
+ ### Tags
164
+ - Avg tags per question: 3.01
165
+ - 5 tags (SO max): 117,671 (15.1%)
166
+ - 1 tag: 92,409 (11.9%)
167
+
168
+ ### Questions Per Year
169
+ - -1: 2,694
170
+ - 2015: 99,664
171
+ - 2016: 120,887
172
+ - 2017: 20,791
173
+ - 2018: 20,096
174
+ - 2020: 99,676
175
+ - 2022: 415,121
176
+ *(Note: 2017/2018 low counts reflect sampling focus; 2022 dominates at 53%)*
177
+
178
+ ### Top 10 Tags
179
+ - python (98,154)
180
+ - javascript (87,156)
181
+ - java (53,052)
182
+ - c# (40,178)
183
+ - android (38,543)
184
+ - html (36,572)
185
+ - php (34,656)
186
+ - reactjs (31,727)
187
+ - css (24,770)
188
+ - r (21,694)
189
+
190
+ ### Unanswered Rate by Top Tags
191
+ - node.js: 36.46% unanswered (hardest to answer)
192
+ - reactjs: 35.31%
193
+ - flutter: 33.44%
194
+ - typescript: 31.19%
195
+ - android: 30.49%
196
+ - python: 28.69%
197
+ - java: 26.88%
198
+ - css: 19.59% (easiest to get answered)
199
+ - jquery: 18.30%
200
+
201
+ ---
202
+
203
+ ## ⚠️ Known Issues & Caveats
204
+
205
+ 1. **YEAR GAPS**: Years 2019 and 2021 are absent β€” this is a sampling artifact, not
206
+ a gap in SO activity. Do not use for temporal trend analysis without noting this.
207
+
208
+ 2. **2022 DOMINANCE**: 415,121 questions (53%) are from 2022. The dataset skews
209
+ heavily toward recent questions. Stratify by year if balance matters.
210
+
211
+ 3. **RAW HTML**: `question_body` contains raw HTML including `&lt;`, `&gt;`,
212
+ `<pre><code>` blocks. Use `body_text` for NLP tasks. Use `question_body` for
213
+ HTML-aware or code-extraction tasks.
214
+
215
+ 4. **SCORE SKEW**: 59.3% of questions have score=0. Mean (0.69) is misleading.
216
+ Use `score_bucket` or `is_highly_voted` for classification tasks.
217
+
218
+ 5. **VIEW COUNT SKEW**: Mean (794) is 12Γ— the median (66) due to viral questions.
219
+ Use log-transformed view_count for regression tasks.
220
+
221
+ 6. **PIPE-SEPARATED TAGS**: The `tags` column uses `|` as delimiter e.g.
222
+ `python|pandas|dataframe`. Split with `str.split("|")` before use.
223
+
224
+ 7. **CODE PLACEHOLDER**: In `body_text`, all `<pre>...</pre>` blocks are replaced
225
+ with the token `[CODE]`. The original HTML is preserved in `question_body`.
226
+
227
+ 8. **DUPLICATE IDs**: 2 exact duplicates were found and removed during processing.
228
+
229
+ ---
230
+
231
+ ## πŸš€ Quick Start
232
+
233
+ ### pandas
234
+
235
+ ```python
236
+ import pandas as pd
237
+
238
+ # Full dataset
239
+ df = pd.read_csv("data/stackoverflow_778k_full.csv")
240
+
241
+ # High quality only (score >= 5, answered)
242
+ hq = pd.read_csv("data/stackoverflow_high_quality.csv")
243
+
244
+ # Python questions only
245
+ py = pd.read_csv("data/stackoverflow_python.csv")
246
+
247
+ # Unanswered questions (good for difficulty modeling)
248
+ ua = pd.read_csv("data/stackoverflow_unanswered.csv")
249
+
250
+ # Split tags into list
251
+ df["tag_list"] = df["tags"].str.split("|")
252
+
253
+ # Filter by year
254
+ df_2022 = df[df["year"] == 2022]
255
+
256
+ # Log-transform view count for regression
257
+ import numpy as np
258
+ df["log_views"] = np.log1p(df["view_count"])
259
+ ```
260
+
261
+ ### HuggingFace datasets
262
+
263
+ ```python
264
+ from datasets import load_dataset
265
+
266
+ REPO = "Omarrran/StackOverflow_778K_Multi_Year_Developer_QA_Dataset"
267
+
268
+ # Full 778K
269
+ ds = load_dataset(REPO, "full")
270
+
271
+ # High quality only
272
+ hq = load_dataset(REPO, "high_quality")
273
+
274
+ # Python questions
275
+ py = load_dataset(REPO, "python")
276
+
277
+ # Unanswered questions
278
+ ua = load_dataset(REPO, "unanswered")
279
+
280
+ # Convert to pandas
281
+ df = ds["train"].to_pandas()
282
+ ```
283
+
284
+ ---
285
+
286
+ ## πŸ”¬ Suggested Research Tasks
287
+
288
+ | Task | Config | Key Columns |
289
+ |------|--------|-------------|
290
+ | Answer prediction (binary) | full | title, body_text, tags β†’ is_unanswered |
291
+ | Score regression | full | title, body_text, tags β†’ score |
292
+ | View count prediction | full | title, tags, score β†’ log(view_count) |
293
+ | Tag recommendation | full | title, body_text β†’ tags |
294
+ | Code vs no-code classification | full | body_text β†’ has_code |
295
+ | Question quality scoring | full | title, body_text β†’ score_bucket |
296
+ | LLM fine-tuning (Q&A) | high_quality | title + body_text as prompt |
297
+ | Difficulty estimation | full | tags β†’ unanswered rate per tag |
298
+ | Time-of-day analysis | full | hour, dayofweek β†’ view_count / score |
299
+ | Language-specific modeling | python/javascript/java | any |
300
+
301
+ ---
302
+
303
+ ## πŸ“‹ Citation
304
+
305
+ ```bibtex
306
+ @dataset{malik2026stackoverflow,
307
+ author = {Malik, Omar Haq Nawaz},
308
+ title = {StackOverflow-778K: Multi-Year Developer Q&A Dataset},
309
+ year = {2026},
310
+ publisher = {HuggingFace},
311
+ url = {https://huggingface.co/datasets/Omarrran/StackOverflow_778K_Multi_Year_Developer_QA_Dataset},
312
+ questions = {778929},
313
+ years = {2015-2022},
314
+ license = {Apache-2.0}
315
+ }
316
+ ```
317
+
318
+ ---
319
+
320
+ ## πŸ‘€ Author
321
+
322
+ **Omar Haq Nawaz Malik** (HuggingFace: [Omarrran](https://huggingface.co/Omarrran))
323
+ AI Engineer & NLP Researcher | BITS Pilani | Srinagar, Kashmir