File size: 1,102 Bytes
61d0ce0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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

```python
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

```python
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())
```