@@ -201,12 +201,12 @@ def flatten(self, max_depth=16) -> "DatasetDict":
201201 >>> from datasets import load_dataset
202202 >>> ds = load_dataset("rajpurkar/squad")
203203 >>> ds["train"].features
204- {'id': Value(dtype= 'string'),
205- 'title': Value(dtype= 'string'),
206- 'context': Value(dtype= 'string'),
207- 'question': Value(dtype= 'string'),
208- 'answers.text': List(feature= Value(dtype= 'string'), length=-1 ),
209- 'answers.answer_start': List(feature= Value(dtype= 'int32'), length=-1 )}
204+ {'id': Value('string'),
205+ 'title': Value('string'),
206+ 'context': Value('string'),
207+ 'question': Value('string'),
208+ 'answers.text': List(Value('string')),
209+ 'answers.answer_start': List(Value('int32'))}
210210 >>> ds.flatten()
211211 DatasetDict({
212212 train: Dataset({
@@ -290,14 +290,14 @@ def cast(self, features: Features) -> "DatasetDict":
290290 >>> ds = load_dataset("cornell-movie-review-data/rotten_tomatoes")
291291 >>> ds["train"].features
292292 {'label': ClassLabel(names=['neg', 'pos']),
293- 'text': Value(dtype= 'string')}
293+ 'text': Value('string')}
294294 >>> new_features = ds["train"].features.copy()
295295 >>> new_features['label'] = ClassLabel(names=['bad', 'good'])
296296 >>> new_features['text'] = Value('large_string')
297297 >>> ds = ds.cast(new_features)
298298 >>> ds["train"].features
299299 {'label': ClassLabel(names=['bad', 'good']),
300- 'text': Value(dtype= 'large_string')}
300+ 'text': Value('large_string')}
301301 ```
302302 """
303303 self ._check_values_type ()
@@ -322,11 +322,11 @@ def cast_column(self, column: str, feature) -> "DatasetDict":
322322 >>> ds = load_dataset("cornell-movie-review-data/rotten_tomatoes")
323323 >>> ds["train"].features
324324 {'label': ClassLabel(names=['neg', 'pos']),
325- 'text': Value(dtype= 'string')}
325+ 'text': Value('string')}
326326 >>> ds = ds.cast_column('label', ClassLabel(names=['bad', 'good']))
327327 >>> ds["train"].features
328328 {'label': ClassLabel(names=['bad', 'good']),
329- 'text': Value(dtype= 'string')}
329+ 'text': Value('string')}
330330 ```
331331 """
332332 self ._check_values_type ()
@@ -513,14 +513,14 @@ def class_encode_column(self, column: str, include_nulls: bool = False) -> "Data
513513 >>> from datasets import load_dataset
514514 >>> ds = load_dataset("boolq")
515515 >>> ds["train"].features
516- {'answer': Value(dtype= 'bool'),
517- 'passage': Value(dtype= 'string'),
518- 'question': Value(dtype= 'string')}
516+ {'answer': Value('bool'),
517+ 'passage': Value('string'),
518+ 'question': Value('string')}
519519 >>> ds = ds.class_encode_column("answer")
520520 >>> ds["train"].features
521521 {'answer': ClassLabel(num_classes=2, names=['False', 'True']),
522- 'passage': Value(dtype= 'string'),
523- 'question': Value(dtype= 'string')}
522+ 'passage': Value('string'),
523+ 'question': Value('string')}
524524 ```
525525 """
526526 self ._check_values_type ()
@@ -2381,11 +2381,11 @@ def cast_column(self, column: str, feature: FeatureType) -> "IterableDatasetDict
23812381 >>> ds = load_dataset("cornell-movie-review-data/rotten_tomatoes", streaming=True)
23822382 >>> ds["train"].features
23832383 {'label': ClassLabel(names=['neg', 'pos']),
2384- 'text': Value(dtype= 'string')}
2384+ 'text': Value('string')}
23852385 >>> ds = ds.cast_column('label', ClassLabel(names=['bad', 'good']))
23862386 >>> ds["train"].features
23872387 {'label': ClassLabel(names=['bad', 'good']),
2388- 'text': Value(dtype= 'string')}
2388+ 'text': Value('string')}
23892389 ```
23902390 """
23912391 return IterableDatasetDict (
@@ -2417,14 +2417,14 @@ def cast(
24172417 >>> ds = load_dataset("cornell-movie-review-data/rotten_tomatoes", streaming=True)
24182418 >>> ds["train"].features
24192419 {'label': ClassLabel(names=['neg', 'pos']),
2420- 'text': Value(dtype= 'string')}
2420+ 'text': Value('string')}
24212421 >>> new_features = ds["train"].features.copy()
24222422 >>> new_features['label'] = ClassLabel(names=['bad', 'good'])
24232423 >>> new_features['text'] = Value('large_string')
24242424 >>> ds = ds.cast(new_features)
24252425 >>> ds["train"].features
24262426 {'label': ClassLabel(names=['bad', 'good']),
2427- 'text': Value(dtype= 'large_string')}
2427+ 'text': Value('large_string')}
24282428 ```
24292429 """
24302430 return IterableDatasetDict ({k : dataset .cast (features = features ) for k , dataset in self .items ()})
0 commit comments