Issue: Fix to_json ValueError and remove pandas pin
State: closed
Author: albertvillanova

This PR fixes the root cause of the issue:
- #6197

This PR also removes the temporary pin of `pandas` introduced by:
- #6200


Note that for orient in ['records', 'values'], index value is ignored but
- in `pandas` < 2.1.0, a ValueError is raised if not index and orient not in ['split', 'table']
  - for orient = 'records', we need index = True
  - default index value is True
- in `pandas` = 2.1.0, a ValueError is raised if index is True and orient in ['records', 'values']
  - for orient = 'records', we need index = False or None
  - default index value is None

This PR fixes the issue by not passing index and thus using default index value (valid for all pandas versions), unless orient is 'split' or 'table' (where we pass index = False, as it was done before this fix).

Comments:
<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.006852 / 0.011353 (-0.004501) | 0.004195 / 0.011008 (-0.006813) | 0.095008 / 0.038508 (0.056500) | 0.073469 / 0.023109 (0.050360) | 0.350170 / 0.275898 (0.074272) | 0.394309 / 0.323480 (0.070829) | 0.004391 / 0.007986 (-0.003595) | 0.003432 / 0.004328 (-0.000896) | 0.072849 / 0.004250 (0.068599) | 0.058595 / 0.037052 (0.021543) | 0.372335 / 0.258489 (0.113846) | 0.410616 / 0.293841 (0.116775) | 0.034477 / 0.128546 (-0.094069) | 0.009426 / 0.075646 (-0.066220) | 0.329262 / 0.419271 (-0.090009) | 0.057941 / 0.043533 (0.014408) | 0.358624 / 0.255139 (0.103485) | 0.413803 / 0.283200 (0.130604) | 0.025845 / 0.141683 (-0.115837) | 1.684289 / 1.452155 (0.232134) | 1.791567 / 1.492716 (0.298850) |

### 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.222731 / 0.018006 (0.204724) | 0.511615 / 0.000490 (0.511126) | 0.004163 / 0.000200 (0.003963) | 0.000088 / 0.000054 (0.000033) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.033260 / 0.037411 (-0.004152) | 0.091685 / 0.014526 (0.077159) | 0.105655 / 0.176557 (-0.070901) | 0.167973 / 0.737135 (-0.569163) | 0.105458 / 0.296338 (-0.190880) |

### 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.441789 / 0.215209 (0.226580) | 4.404803 / 2.077655 (2.327148) | 2.163739 / 1.504120 (0.659620) | 1.956828 / 1.541195 (0.415633) | 2.042183 / 1.468490 (0.573693) | 0.552221 / 4.584777 (-4.032556) | 3.951769 / 3.745712 (0.206057) | 3.591983 / 5.269862 (-1.677878) | 2.225058 / 4.565676 (-2.340619) | 0.064528 / 0.424275 (-0.359747) | 0.008403 / 0.007607 (0.000796) | 0.528830 / 0.226044 (0.302786) | 5.233686 / 2.268929 (2.964757) | 2.681156 / 55.444624 (-52.763468) | 2.261188 / 6.876477 (-4.615289) | 2.470037 / 2.142072 (0.327964) | 0.661793 / 4.805227 (-4.143434) | 0.150138 / 6.500664 (-6.350527) | 0.068663 / 0.075469 (-0.006807) |

### 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.463086 / 1.841788 (-0.378701) | 21.408232 / 8.074308 (13.333924) | 15.521718 / 10.191392 (5.330326) | 0.164587 / 0.680424 (-0.515837) | 0.021035 / 0.534201 (-0.513166) | 0.445466 / 0.579283 (-0.133817) | 0.462489 / 0.434364 (0.028125) | 0.517733 / 0.540337 (-0.022604) | 0.724242 / 1.386936 (-0.662694) |

</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.007117 / 0.011353 (-0.004236) | 0.004230 / 0.011008 (-0.006778) | 0.072186 / 0.038508 (0.033678) | 0.076758 / 0.023109 (0.053648) | 0.452606 / 0.275898 (0.176708) | 0.491872 / 0.323480 (0.168392) | 0.005989 / 0.007986 (-0.001996) | 0.003611 / 0.004328 (-0.000717) | 0.072642 / 0.004250 (0.068392) | 0.058985 / 0.037052 (0.021933) | 0.463414 / 0.258489 (0.204925) | 0.497538 / 0.293841 (0.203697) | 0.036325 / 0.128546 (-0.092221) | 0.009814 / 0.075646 (-0.065832) | 0.078745 / 0.419271 (-0.340527) | 0.054308 / 0.043533 (0.010775) | 0.468210 / 0.255139 (0.213071) | 0.476434 / 0.283200 (0.193234) | 0.023683 / 0.141683 (-0.118000) | 1.706457 / 1.452155 (0.254302) | 1.775855 / 1.492716 (0.283139) |

### 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.241599 / 0.018006 (0.223592) | 0.483859 / 0.000490 (0.483370) | 0.006432 / 0.000200 (0.006233) | 0.000177 / 0.000054 (0.000123) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.034723 / 0.037411 (-0.002688) | 0.104420 / 0.014526 (0.089894) | 0.121071 / 0.176557 (-0.055486) | 0.174899 / 0.737135 (-0.562237) | 0.119587 / 0.296338 (-0.176751) |

### 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.492731 / 0.215209 (0.277522) | 4.898621 / 2.077655 (2.820967) | 2.710931 / 1.504120 (1.206811) | 2.513889 / 1.541195 (0.972694) | 2.578073 / 1.468490 (1.109583) | 0.548318 / 4.584777 (-4.036459) | 4.048603 / 3.745712 (0.302891) | 3.637654 / 5.269862 (-1.632208) | 2.263682 / 4.565676 (-2.301994) | 0.065786 / 0.424275 (-0.358489) | 0.008119 / 0.007607 (0.000512) | 0.578693 / 0.226044 (0.352649) | 5.780619 / 2.268929 (3.511691) | 3.224625 / 55.444624 (-52.220000) | 2.838750 / 6.876477 (-4.037726) | 2.970276 / 2.142072 (0.828204) | 0.654423 / 4.805227 (-4.150805) | 0.148696 / 6.500664 (-6.351969) | 0.066469 / 0.075469 (-0.009000) |

### 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.574772 / 1.841788 (-0.267015) | 21.822356 / 8.074308 (13.748048) | 16.504127 / 10.191392 (6.312735) | 0.183357 / 0.680424 (-0.497067) | 0.022759 / 0.534201 (-0.511442) | 0.453746 / 0.579283 (-0.125537) | 0.447037 / 0.434364 (0.012673) | 0.536562 / 0.540337 (-0.003775) | 0.731063 / 1.386936 (-0.655873) |

</details>
</details>

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


_The documentation is not available anymore as the PR was closed or merged._

<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.008542 / 0.011353 (-0.002811) | 0.005481 / 0.011008 (-0.005527) | 0.100122 / 0.038508 (0.061614) | 0.078968 / 0.023109 (0.055858) | 0.403751 / 0.275898 (0.127853) | 0.457559 / 0.323480 (0.134079) | 0.006152 / 0.007986 (-0.001834) | 0.003805 / 0.004328 (-0.000523) | 0.072787 / 0.004250 (0.068536) | 0.054794 / 0.037052 (0.017741) | 0.419815 / 0.258489 (0.161326) | 0.437453 / 0.293841 (0.143612) | 0.044641 / 0.128546 (-0.083905) | 0.013755 / 0.075646 (-0.061892) | 0.374683 / 0.419271 (-0.044589) | 0.071442 / 0.043533 (0.027909) | 0.395814 / 0.255139 (0.140675) | 0.439042 / 0.283200 (0.155842) | 0.034596 / 0.141683 (-0.107087) | 1.655056 / 1.452155 (0.202902) | 1.826410 / 1.492716 (0.333694) |

### 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.278667 / 0.018006 (0.260661) | 0.617354 / 0.000490 (0.616864) | 0.004111 / 0.000200 (0.003911) | 0.000138 / 0.000054 (0.000083) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.025905 / 0.037411 (-0.011506) | 0.084721 / 0.014526 (0.070195) | 0.099737 / 0.176557 (-0.076819) | 0.163016 / 0.737135 (-0.574119) | 0.095104 / 0.296338 (-0.201234) |

### 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.531589 / 0.215209 (0.316380) | 5.455303 / 2.077655 (3.377649) | 2.495112 / 1.504120 (0.990992) | 2.234139 / 1.541195 (0.692944) | 2.295090 / 1.468490 (0.826599) | 0.777627 / 4.584777 (-3.807150) | 5.053069 / 3.745712 (1.307357) | 4.488715 / 5.269862 (-0.781147) | 2.775991 / 4.565676 (-1.789686) | 0.094175 / 0.424275 (-0.330100) | 0.008681 / 0.007607 (0.001074) | 0.668174 / 0.226044 (0.442130) | 6.631876 / 2.268929 (4.362948) | 3.118055 / 55.444624 (-52.326569) | 2.480355 / 6.876477 (-4.396122) | 2.706643 / 2.142072 (0.564571) | 0.927173 / 4.805227 (-3.878054) | 0.217385 / 6.500664 (-6.283279) | 0.067110 / 0.075469 (-0.008359) |

### 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.517926 / 1.841788 (-0.323861) | 21.420546 / 8.074308 (13.346238) | 21.108266 / 10.191392 (10.916874) | 0.222449 / 0.680424 (-0.457975) | 0.027969 / 0.534201 (-0.506232) | 0.459484 / 0.579283 (-0.119799) | 0.582629 / 0.434364 (0.148265) | 0.520971 / 0.540337 (-0.019366) | 0.694270 / 1.386936 (-0.692666) |

</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.008257 / 0.011353 (-0.003096) | 0.004511 / 0.011008 (-0.006497) | 0.075031 / 0.038508 (0.036523) | 0.070526 / 0.023109 (0.047416) | 0.445595 / 0.275898 (0.169697) | 0.512312 / 0.323480 (0.188832) | 0.005933 / 0.007986 (-0.002052) | 0.003814 / 0.004328 (-0.000515) | 0.073553 / 0.004250 (0.069302) | 0.058174 / 0.037052 (0.021121) | 0.472307 / 0.258489 (0.213818) | 0.519679 / 0.293841 (0.225838) | 0.046027 / 0.128546 (-0.082520) | 0.011757 / 0.075646 (-0.063889) | 0.084883 / 0.419271 (-0.334388) | 0.056476 / 0.043533 (0.012943) | 0.475608 / 0.255139 (0.220469) | 0.507588 / 0.283200 (0.224388) | 0.031661 / 0.141683 (-0.110022) | 1.673183 / 1.452155 (0.221028) | 1.736836 / 1.492716 (0.244120) |

### 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.350887 / 0.018006 (0.332881) | 0.589796 / 0.000490 (0.589306) | 0.023066 / 0.000200 (0.022867) | 0.000106 / 0.000054 (0.000052) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.030764 / 0.037411 (-0.006647) | 0.116967 / 0.014526 (0.102441) | 0.102760 / 0.176557 (-0.073796) | 0.167690 / 0.737135 (-0.569445) | 0.111350 / 0.296338 (-0.184988) |

### 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.584565 / 0.215209 (0.369356) | 5.898081 / 2.077655 (3.820426) | 2.770374 / 1.504120 (1.266254) | 2.467519 / 1.541195 (0.926324) | 2.463319 / 1.468490 (0.994829) | 0.794294 / 4.584777 (-3.790483) | 5.272285 / 3.745712 (1.526573) | 4.514830 / 5.269862 (-0.755032) | 2.937259 / 4.565676 (-1.628417) | 0.093702 / 0.424275 (-0.330574) | 0.008012 / 0.007607 (0.000405) | 0.772371 / 0.226044 (0.546327) | 7.574941 / 2.268929 (5.306013) | 3.710965 / 55.444624 (-51.733659) | 2.927964 / 6.876477 (-3.948513) | 3.256036 / 2.142072 (1.113964) | 1.051649 / 4.805227 (-3.753578) | 0.203055 / 6.500664 (-6.297609) | 0.081072 / 0.075469 (0.005603) |

### 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.574251 / 1.841788 (-0.267537) | 22.340801 / 8.074308 (14.266493) | 20.497769 / 10.191392 (10.306377) | 0.228725 / 0.680424 (-0.451699) | 0.029095 / 0.534201 (-0.505106) | 0.452460 / 0.579283 (-0.126823) | 0.586419 / 0.434364 (0.152055) | 0.571237 / 0.540337 (0.030900) | 0.745069 / 1.386936 (-0.641867) |

</details>
</details>

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


<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.006529 / 0.011353 (-0.004824) | 0.004062 / 0.011008 (-0.006946) | 0.083712 / 0.038508 (0.045204) | 0.072378 / 0.023109 (0.049269) | 0.358779 / 0.275898 (0.082881) | 0.387216 / 0.323480 (0.063736) | 0.004038 / 0.007986 (-0.003948) | 0.003316 / 0.004328 (-0.001013) | 0.065207 / 0.004250 (0.060956) | 0.054439 / 0.037052 (0.017386) | 0.370689 / 0.258489 (0.112200) | 0.411008 / 0.293841 (0.117167) | 0.031133 / 0.128546 (-0.097413) | 0.008600 / 0.075646 (-0.067047) | 0.287753 / 0.419271 (-0.131518) | 0.051845 / 0.043533 (0.008312) | 0.360327 / 0.255139 (0.105188) | 0.394791 / 0.283200 (0.111591) | 0.025139 / 0.141683 (-0.116544) | 1.488151 / 1.452155 (0.035996) | 1.556776 / 1.492716 (0.064059) |

### 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.209462 / 0.018006 (0.191456) | 0.459168 / 0.000490 (0.458678) | 0.006037 / 0.000200 (0.005837) | 0.000079 / 0.000054 (0.000025) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.028444 / 0.037411 (-0.008967) | 0.082974 / 0.014526 (0.068448) | 0.094919 / 0.176557 (-0.081638) | 0.151875 / 0.737135 (-0.585260) | 0.096143 / 0.296338 (-0.200195) |

### 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.402675 / 0.215209 (0.187466) | 4.014787 / 2.077655 (1.937133) | 2.015793 / 1.504120 (0.511673) | 1.838976 / 1.541195 (0.297782) | 1.931733 / 1.468490 (0.463243) | 0.489435 / 4.584777 (-4.095342) | 3.581662 / 3.745712 (-0.164050) | 3.315392 / 5.269862 (-1.954469) | 2.053369 / 4.565676 (-2.512307) | 0.057749 / 0.424275 (-0.366526) | 0.007720 / 0.007607 (0.000113) | 0.483388 / 0.226044 (0.257343) | 4.820798 / 2.268929 (2.551870) | 2.544264 / 55.444624 (-52.900361) | 2.170513 / 6.876477 (-4.705963) | 2.416976 / 2.142072 (0.274903) | 0.588351 / 4.805227 (-4.216876) | 0.136988 / 6.500664 (-6.363676) | 0.062294 / 0.075469 (-0.013175) |

### 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.263807 / 1.841788 (-0.577980) | 19.888202 / 8.074308 (11.813894) | 14.352977 / 10.191392 (4.161585) | 0.167200 / 0.680424 (-0.513224) | 0.018449 / 0.534201 (-0.515752) | 0.393262 / 0.579283 (-0.186021) | 0.407854 / 0.434364 (-0.026510) | 0.455852 / 0.540337 (-0.084485) | 0.629024 / 1.386936 (-0.757912) |

</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.006642 / 0.011353 (-0.004710) | 0.004041 / 0.011008 (-0.006967) | 0.065823 / 0.038508 (0.027315) | 0.076810 / 0.023109 (0.053701) | 0.397680 / 0.275898 (0.121782) | 0.430104 / 0.323480 (0.106624) | 0.006035 / 0.007986 (-0.001951) | 0.003389 / 0.004328 (-0.000939) | 0.066056 / 0.004250 (0.061806) | 0.054222 / 0.037052 (0.017170) | 0.397964 / 0.258489 (0.139475) | 0.439277 / 0.293841 (0.145436) | 0.032394 / 0.128546 (-0.096152) | 0.008586 / 0.075646 (-0.067060) | 0.072538 / 0.419271 (-0.346734) | 0.048346 / 0.043533 (0.004813) | 0.399631 / 0.255139 (0.144492) | 0.418684 / 0.283200 (0.135484) | 0.022570 / 0.141683 (-0.119113) | 1.519788 / 1.452155 (0.067633) | 1.581457 / 1.492716 (0.088740) |

### 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.243443 / 0.018006 (0.225436) | 0.453095 / 0.000490 (0.452606) | 0.009940 / 0.000200 (0.009740) | 0.000121 / 0.000054 (0.000066) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.032293 / 0.037411 (-0.005118) | 0.091681 / 0.014526 (0.077155) | 0.103729 / 0.176557 (-0.072827) | 0.156361 / 0.737135 (-0.580775) | 0.105034 / 0.296338 (-0.191305) |

### 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.427761 / 0.215209 (0.212551) | 4.266044 / 2.077655 (2.188390) | 2.285161 / 1.504120 (0.781041) | 2.118652 / 1.541195 (0.577457) | 2.203469 / 1.468490 (0.734979) | 0.494587 / 4.584777 (-4.090190) | 3.676706 / 3.745712 (-0.069006) | 3.252478 / 5.269862 (-2.017383) | 2.027432 / 4.565676 (-2.538245) | 0.057856 / 0.424275 (-0.366419) | 0.007279 / 0.007607 (-0.000328) | 0.502767 / 0.226044 (0.276723) | 5.031409 / 2.268929 (2.762480) | 2.741767 / 55.444624 (-52.702858) | 2.408480 / 6.876477 (-4.467997) | 2.607193 / 2.142072 (0.465121) | 0.590787 / 4.805227 (-4.214440) | 0.133633 / 6.500664 (-6.367031) | 0.061195 / 0.075469 (-0.014274) |

### 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.342824 / 1.841788 (-0.498964) | 20.137195 / 8.074308 (12.062887) | 14.986743 / 10.191392 (4.795351) | 0.168218 / 0.680424 (-0.512206) | 0.020209 / 0.534201 (-0.513992) | 0.397446 / 0.579283 (-0.181837) | 0.427496 / 0.434364 (-0.006868) | 0.475058 / 0.540337 (-0.065279) | 0.648439 / 1.386936 (-0.738497) |

</details>
</details>

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