Bradford Levy commited on
Commit
ce48a79
·
verified ·
1 Parent(s): 067b19c

Added example of loading data in Datasets

Browse files
Files changed (1) hide show
  1. README.md +18 -1
README.md CHANGED
@@ -38,7 +38,7 @@ BeanCounter is a dataset of business-oriented text. The data is sourced from the
38
  - `sample`: 1.1B tokens randomly sampled from `default` stratified by year
39
 
40
  ## How can I use this?
41
-
42
  The dataset is provided under the [ODC-By](https://opendatacommons.org/licenses/by/1-0/) license. Cite our work as:
43
 
44
  ```
@@ -51,3 +51,20 @@ The dataset is provided under the [ODC-By](https://opendatacommons.org/licenses/
51
  year={2024}
52
  }
53
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  - `sample`: 1.1B tokens randomly sampled from `default` stratified by year
39
 
40
  ## How can I use this?
41
+ ### License
42
  The dataset is provided under the [ODC-By](https://opendatacommons.org/licenses/by/1-0/) license. Cite our work as:
43
 
44
  ```
 
51
  year={2024}
52
  }
53
  ```
54
+ ### In Hugging Face Datasets
55
+ To load the random sample config in Datasets, one can run:
56
+ ```python
57
+ from datasets import load_dataset
58
+
59
+ beancounter = load_dataset(
60
+ "blevy41/BeanCounter",
61
+ name="sample", # Load random sample, clean, or final
62
+ )
63
+
64
+ # Print out split info
65
+ print(beancounter, '\n')
66
+
67
+ # Inspect an observation
68
+ print(f"COLUMNS IN DATA: {','.join(beancounter['train'][1000].keys())}\n")
69
+ print(f"EXCERPT: \n\n{beancounter['train'][1000]['text'][:1000]}")
70
+ ```