`remove_columns`/`rename_columns` doc fixes
State: closed

Use more consistent wording in `remove_columns` to explain why it's faster than `map` and update `remove_columns`/`rename_columns` docstrings to fix in-place calls.


Reported in https://github.com/huggingface/datasets/issues/6700

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6772). 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.005728 / 0.011353 (-0.005624) | 0.003809 / 0.011008 (-0.007199) | 0.062930 / 0.038508 (0.024422) | 0.032320 / 0.023109 (0.009211) | 0.251072 / 0.275898 (-0.024826) | 0.275397 / 0.323480 (-0.048083) | 0.003314 / 0.007986 (-0.004671) | 0.002869 / 0.004328 (-0.001460) | 0.049070 / 0.004250 (0.044819) | 0.049282 / 0.037052 (0.012229) | 0.263546 / 0.258489 (0.005057) | 0.291471 / 0.293841 (-0.002370) | 0.028462 / 0.128546 (-0.100084) | 0.010528 / 0.075646 (-0.065119) | 0.211249 / 0.419271 (-0.208023) | 0.036840 / 0.043533 (-0.006693) | 0.250038 / 0.255139 (-0.005101) | 0.268883 / 0.283200 (-0.014317) | 0.021417 / 0.141683 (-0.120266) | 1.139754 / 1.452155 (-0.312400) | 1.197319 / 1.492716 (-0.295397) |

### 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.094191 / 0.018006 (0.076185) | 0.302413 / 0.000490 (0.301923) | 0.000220 / 0.000200 (0.000020) | 0.000048 / 0.000054 (-0.000006) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018490 / 0.037411 (-0.018922) | 0.063361 / 0.014526 (0.048835) | 0.075854 / 0.176557 (-0.100702) | 0.121499 / 0.737135 (-0.615637) | 0.075982 / 0.296338 (-0.220356) |

### 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.286030 / 0.215209 (0.070821) | 2.778487 / 2.077655 (0.700832) | 1.440963 / 1.504120 (-0.063157) | 1.326217 / 1.541195 (-0.214977) | 1.359228 / 1.468490 (-0.109262) | 0.566999 / 4.584777 (-4.017778) | 2.453344 / 3.745712 (-1.292368) | 2.841448 / 5.269862 (-2.428413) | 1.825197 / 4.565676 (-2.740479) | 0.062301 / 0.424275 (-0.361974) | 0.004948 / 0.007607 (-0.002659) | 0.334578 / 0.226044 (0.108534) | 3.302327 / 2.268929 (1.033399) | 1.799808 / 55.444624 (-53.644817) | 1.529693 / 6.876477 (-5.346783) | 1.564684 / 2.142072 (-0.577389) | 0.632891 / 4.805227 (-4.172336) | 0.116594 / 6.500664 (-6.384070) | 0.042695 / 0.075469 (-0.032774) |

### 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.999994 / 1.841788 (-0.841794) | 12.767365 / 8.074308 (4.693057) | 10.550439 / 10.191392 (0.359047) | 0.133437 / 0.680424 (-0.546986) | 0.015252 / 0.534201 (-0.518949) | 0.293285 / 0.579283 (-0.285998) | 0.274773 / 0.434364 (-0.159590) | 0.328718 / 0.540337 (-0.211619) | 0.428021 / 1.386936 (-0.958915) |

</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.005538 / 0.011353 (-0.005815) | 0.003738 / 0.011008 (-0.007271) | 0.050179 / 0.038508 (0.011671) | 0.032441 / 0.023109 (0.009332) | 0.294721 / 0.275898 (0.018823) | 0.322616 / 0.323480 (-0.000864) | 0.004255 / 0.007986 (-0.003731) | 0.002913 / 0.004328 (-0.001416) | 0.049044 / 0.004250 (0.044794) | 0.042361 / 0.037052 (0.005309) | 0.304162 / 0.258489 (0.045673) | 0.332757 / 0.293841 (0.038916) | 0.029355 / 0.128546 (-0.099191) | 0.010546 / 0.075646 (-0.065100) | 0.058213 / 0.419271 (-0.361058) | 0.032648 / 0.043533 (-0.010885) | 0.298241 / 0.255139 (0.043102) | 0.313710 / 0.283200 (0.030510) | 0.017836 / 0.141683 (-0.123847) | 1.135050 / 1.452155 (-0.317104) | 1.178277 / 1.492716 (-0.314439) |

### 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.094387 / 0.018006 (0.076381) | 0.301955 / 0.000490 (0.301466) | 0.000220 / 0.000200 (0.000020) | 0.000052 / 0.000054 (-0.000002) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.023135 / 0.037411 (-0.014276) | 0.078109 / 0.014526 (0.063583) | 0.087519 / 0.176557 (-0.089037) | 0.127815 / 0.737135 (-0.609320) | 0.090107 / 0.296338 (-0.206231) |

### 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.289149 / 0.215209 (0.073940) | 2.832354 / 2.077655 (0.754699) | 1.574003 / 1.504120 (0.069883) | 1.449190 / 1.541195 (-0.092005) | 1.465798 / 1.468490 (-0.002692) | 0.561953 / 4.584777 (-4.022824) | 2.445788 / 3.745712 (-1.299924) | 2.882453 / 5.269862 (-2.387409) | 1.813267 / 4.565676 (-2.752409) | 0.063163 / 0.424275 (-0.361112) | 0.005785 / 0.007607 (-0.001822) | 0.340125 / 0.226044 (0.114081) | 3.355370 / 2.268929 (1.086442) | 1.924226 / 55.444624 (-53.520398) | 1.643242 / 6.876477 (-5.233234) | 1.650149 / 2.142072 (-0.491924) | 0.654818 / 4.805227 (-4.150409) | 0.114968 / 6.500664 (-6.385696) | 0.042044 / 0.075469 (-0.033425) |

### 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.024867 / 1.841788 (-0.816921) | 12.656140 / 8.074308 (4.581832) | 10.927014 / 10.191392 (0.735622) | 0.155929 / 0.680424 (-0.524495) | 0.015356 / 0.534201 (-0.518845) | 0.289834 / 0.579283 (-0.289449) | 0.280889 / 0.434364 (-0.153475) | 0.331490 / 0.540337 (-0.208847) | 0.418037 / 1.386936 (-0.968899) |

</details>
</details>

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