news_2026_exercise / README.md
maher13's picture
Upload folder using huggingface_hub
61d0ce0 verified
|
Raw
History Blame Contribute Delete
1.1 kB
metadata
license: apache-2.0
task_categories:
  - text-classification
language:
  - ar
tags:
  - news
  - arabic
  - classification
pretty_name: news_2026_exercise
size_categories:
  - 10K<n<100K

news_2026_exercise

Arabic news dataset for text classification.

Column Description
title News title
content News body
category Label: سياسة, اقتصاد, صحة, رياضة

28,000 rows (7,000 per category).

Download and load as pandas

from datasets import load_dataset
import pandas as pd

ds = load_dataset("maher13/news_2026_exercise")
df = ds["train"].to_pandas()
print(df.head())

Sample N rows from each category

from datasets import load_dataset
import pandas as pd

N = 100  # change this

ds = load_dataset("maher13/news_2026_exercise")
df = ds["train"].to_pandas()

sample_df = (
    df.groupby("category", group_keys=False)
    .apply(lambda x: x.sample(n=min(N, len(x)), random_state=42))
    .reset_index(drop=True)
)

print(sample_df["category"].value_counts())
print(sample_df.head())