tosinamuda commited on
Commit
c258bad
·
verified ·
1 Parent(s): 8fb83b0

Load the combined dataset in the quick start

Browse files
Files changed (1) hide show
  1. README.md +16 -6
README.md CHANGED
@@ -47,18 +47,28 @@ Real-world records may have a `screenshot_file` pointing to the original screens
47
 
48
  ## Quick start
49
 
 
 
50
  ```python
51
- import json
52
- import pandas as pd
53
 
54
- ke = pd.read_csv("data/kenya/af-scam-ke-v0.1.csv")
55
- for col in ["tactics", "requested_action", "risk_indicators", "language_tags"]:
56
- ke[col] = ke[col].apply(lambda v: json.loads(v) if isinstance(v, str) else [])
57
 
58
- real = ke[ke.record_origin == "real_world"]
59
  print(real.explode("tactics").tactics.value_counts())
60
  ```
61
 
 
 
 
 
 
 
 
 
 
 
62
  ## Status
63
 
64
  Version 0.1 is a draft. All records are `pending_review`.
 
47
 
48
  ## Quick start
49
 
50
+ Load the dataset from Hugging Face:
51
+
52
  ```python
53
+ from datasets import load_dataset
 
54
 
55
+ ds = load_dataset("Afrieval/african-scam-message-patterns", split="train")
56
+ df = ds.to_pandas()
 
57
 
58
+ real = df[df.record_origin == "real_world"]
59
  print(real.explode("tactics").tactics.value_counts())
60
  ```
61
 
62
+ Or read the file from a clone of this repository:
63
+
64
+ ```python
65
+ import pandas as pd
66
+
67
+ df = pd.read_json("data/afriscam-v0.1.jsonl", lines=True)
68
+ ```
69
+
70
+ `tactics`, `requested_action`, `risk_indicators` and `language_tags` load as lists.
71
+
72
  ## Status
73
 
74
  Version 0.1 is a draft. All records are `pending_review`.