You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

50K Stack Overflow Q&A Dataset

A curated collection of 50,000 high-quality Stack Overflow question-answer pairs, filtered for quality and diversity across multiple programming languages.

Dataset Overview

Metric Value
Total Q&A Pairs 50,000
Average Question Score 267.16
Average Answer Score 339.50
Highest Question Score 26,621
Minimum Question Score 93

Available Formats

Format File Size
CSV 50K_stackoverflow.csv 111.60 MB
Parquet 50K_stackoverflow.parquet 58.37 MB
JSONL 50K_stackoverflow.jsonl 125.24 MB

Programming Language Distribution

The dataset covers questions across multiple programming languages and technologies:

Language Questions Percentage
JavaScript 333 24.1%
Python 273 19.8%
Java 132 9.6%
PHP 102 7.4%
TypeScript 100 7.2%
C# 91 6.6%
Go 82 5.9%
Ruby 73 5.3%
C++ 63 4.6%
Swift 28 2.0%
SQL 17 1.2%
Other 706 6.3%

Dataset Schema

Each record contains the following fields:

Field Type Description
question_title string The title of the Stack Overflow question
question_body string Full text content of the question
question_score integer Community upvotes on the question
answer_body string The accepted/top-voted answer text
answer_score integer Community upvotes on the answer
tags string Pipe-separated tags (e.g., java|c++|performance)

Sample Entry

Question Title: Why is processing a sorted array faster than processing an unsorted array?

Tags: java | c++ | performance | cpu-architecture | branch-prediction

Metric Score
Question Score 26,621
Answer Score 34,269

Quality Filtering Criteria

This dataset was curated with the following quality filters:

  • Minimum question score threshold of 93
  • Only includes questions with accepted or highly-voted answers
  • Covers diverse programming topics and languages
  • Excludes closed, duplicate, or low-quality posts

Use Cases

This dataset is ideal for:

  • LLM Fine-tuning: Train models to answer programming questions
  • Code Understanding: Build systems that comprehend code-related queries
  • Information Retrieval: Develop semantic search for technical documentation
  • Question Answering Systems: Create domain-specific QA models
  • Educational Tools: Power programming tutors and learning assistants
  • Text Classification: Train models to categorize technical content

Loading the Dataset

Python (Pandas)

import pandas as pd

# Load CSV
df = pd.read_csv('50K_stackoverflow.csv')

# Load Parquet (recommended for performance)
df = pd.read_parquet('50K_stackoverflow.parquet')

Python (JSONL)

import json

data = []
with open('50K_stackoverflow.jsonl', 'r') as f:
    for line in f:
        data.append(json.loads(line))

Hugging Face Datasets

from datasets import load_dataset

dataset = load_dataset('Omarrran/50K_stackoverflow_qna_dataset_by_hnm')

File Format Recommendations

Use Case Recommended Format
Data Analysis Parquet
Machine Learning Parquet
Streaming/Processing JSONL
Spreadsheet Tools CSV
Storage Efficiency Parquet (52% smaller than CSV)

Citation

If you use this dataset in your research or projects, please cite:

@dataset{stackoverflow_50k_qa,
  title={Omarrran/50K_stackoverflow_qna_dataset_by_hnma},
  Author= {Haq Nawaz Malik}
  year={2025},
  url={https://huggingface.co/datasets/Omarrran/50K_stackoverflow_qna_dataset_by_hnm/}
  
}

License

This dataset is derived from Stack Overflow content, which is licensed under CC BY-SA 4.0. Any use of this dataset must comply with Stack Overflow's terms of service and attribution requirements.

Acknowledgments


Note: This dataset represents a snapshot of Stack Overflow content and may not reflect the most current answers or best practices for rapidly evolving technologies.

Downloads last month
2