Title: update docs on N-dim arrays
Author: lhoestq (MEMBER)
State: closed
Created: 2024-06-04T16:32:19Z


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6956). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

<details>
<summary>Show benchmarks</summary>

PyArrow==8.0.0

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005348 / 0.011353 (-0.006005) | 0.003785 / 0.011008 (-0.007223) | 0.061674 / 0.038508 (0.023166) | 0.032127 / 0.023109 (0.009017) | 0.247095 / 0.275898 (-0.028803) | 0.276466 / 0.323480 (-0.047014) | 0.004197 / 0.007986 (-0.003789) | 0.002734 / 0.004328 (-0.001594) | 0.049604 / 0.004250 (0.045354) | 0.048553 / 0.037052 (0.011500) | 0.253230 / 0.258489 (-0.005259) | 0.286954 / 0.293841 (-0.006887) | 0.028181 / 0.128546 (-0.100365) | 0.010602 / 0.075646 (-0.065044) | 0.200719 / 0.419271 (-0.218552) | 0.037278 / 0.043533 (-0.006254) | 0.251565 / 0.255139 (-0.003574) | 0.269026 / 0.283200 (-0.014174) | 0.017632 / 0.141683 (-0.124050) | 1.136216 / 1.452155 (-0.315939) | 1.181158 / 1.492716 (-0.311559) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.004892 / 0.018006 (-0.013114) | 0.312921 / 0.000490 (0.312431) | 0.000247 / 0.000200 (0.000047) | 0.000054 / 0.000054 (-0.000000) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019303 / 0.037411 (-0.018108) | 0.062699 / 0.014526 (0.048174) | 0.075227 / 0.176557 (-0.101329) | 0.122919 / 0.737135 (-0.614217) | 0.076506 / 0.296338 (-0.219833) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.277299 / 0.215209 (0.062090) | 2.754771 / 2.077655 (0.677116) | 1.457164 / 1.504120 (-0.046956) | 1.318878 / 1.541195 (-0.222317) | 1.374245 / 1.468490 (-0.094245) | 0.566253 / 4.584777 (-4.018524) | 2.352589 / 3.745712 (-1.393123) | 2.764263 / 5.269862 (-2.505599) | 1.843141 / 4.565676 (-2.722535) | 0.063996 / 0.424275 (-0.360279) | 0.005045 / 0.007607 (-0.002562) | 0.336703 / 0.226044 (0.110658) | 3.342538 / 2.268929 (1.073609) | 1.836664 / 55.444624 (-53.607960) | 1.528901 / 6.876477 (-5.347576) | 1.769562 / 2.142072 (-0.372511) | 0.674192 / 4.805227 (-4.131035) | 0.122421 / 6.500664 (-6.378243) | 0.043714 / 0.075469 (-0.031756) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.989432 / 1.841788 (-0.852356) | 12.178341 / 8.074308 (4.104033) | 9.730838 / 10.191392 (-0.460554) | 0.146751 / 0.680424 (-0.533673) | 0.014720 / 0.534201 (-0.519481) | 0.285821 / 0.579283 (-0.293462) | 0.266474 / 0.434364 (-0.167889) | 0.327886 / 0.540337 (-0.212451) | 0.455672 / 1.386936 (-0.931264) |

</details>
PyArrow==latest

<details>
<summary>Show updated benchmarks!</summary>

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005691 / 0.011353 (-0.005662) | 0.004089 / 0.011008 (-0.006919) | 0.049878 / 0.038508 (0.011370) | 0.033578 / 0.023109 (0.010469) | 0.268295 / 0.275898 (-0.007603) | 0.288918 / 0.323480 (-0.034561) | 0.005092 / 0.007986 (-0.002894) | 0.002916 / 0.004328 (-0.001412) | 0.049489 / 0.004250 (0.045239) | 0.042495 / 0.037052 (0.005442) | 0.276253 / 0.258489 (0.017764) | 0.313321 / 0.293841 (0.019480) | 0.029386 / 0.128546 (-0.099160) | 0.010926 / 0.075646 (-0.064720) | 0.071747 / 0.419271 (-0.347525) | 0.033642 / 0.043533 (-0.009891) | 0.264950 / 0.255139 (0.009811) | 0.282962 / 0.283200 (-0.000238) | 0.018878 / 0.141683 (-0.122805) | 1.170685 / 1.452155 (-0.281470) | 1.198321 / 1.492716 (-0.294396) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.100422 / 0.018006 (0.082415) | 0.311750 / 0.000490 (0.311260) | 0.000235 / 0.000200 (0.000035) | 0.000063 / 0.000054 (0.000008) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.023093 / 0.037411 (-0.014318) | 0.076934 / 0.014526 (0.062408) | 0.088959 / 0.176557 (-0.087598) | 0.129511 / 0.737135 (-0.607624) | 0.090151 / 0.296338 (-0.206187) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.301646 / 0.215209 (0.086437) | 2.961780 / 2.077655 (0.884126) | 1.656051 / 1.504120 (0.151931) | 1.533154 / 1.541195 (-0.008041) | 1.585152 / 1.468490 (0.116662) | 0.582157 / 4.584777 (-4.002620) | 0.954881 / 3.745712 (-2.790831) | 2.813174 / 5.269862 (-2.456688) | 1.842840 / 4.565676 (-2.722837) | 0.065598 / 0.424275 (-0.358677) | 0.005306 / 0.007607 (-0.002301) | 0.359610 / 0.226044 (0.133565) | 3.575320 / 2.268929 (1.306391) | 2.015327 / 55.444624 (-53.429297) | 1.734086 / 6.876477 (-5.142391) | 1.919081 / 2.142072 (-0.222991) | 0.671178 / 4.805227 (-4.134049) | 0.120109 / 6.500664 (-6.380555) | 0.042353 / 0.075469 (-0.033116) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.011726 / 1.841788 (-0.830062) | 13.007806 / 8.074308 (4.933498) | 10.632486 / 10.191392 (0.441094) | 0.148535 / 0.680424 (-0.531889) | 0.015988 / 0.534201 (-0.518213) | 0.290023 / 0.579283 (-0.289260) | 0.130685 / 0.434364 (-0.303679) | 0.322912 / 0.540337 (-0.217425) | 0.420596 / 1.386936 (-0.966340) |

</details>
</details>

![](https://cml.dev/watermark.png#336512dcba4fdb4c349d5ecb632b6ced80e038d5 "CML watermark")