Title: PyArrow 13 CI fixes
State: closed

Fixes:
* bumps the PyArrow version check in the `cast_array_to_feature` to avoid the offset bug (still not fixed)
* aligns the Pandas formatting tests with the Numpy ones (the current test fails due to https://github.com/apache/arrow/pull/35656, which requires `.to_pandas(coerce_temporal_nanoseconds=True)` to always return `datetime [ns]` objects)

Fix #6173 


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.006095 / 0.011353 (-0.005258) | 0.003580 / 0.011008 (-0.007429) | 0.080146 / 0.038508 (0.041638) | 0.063445 / 0.023109 (0.040336) | 0.321930 / 0.275898 (0.046032) | 0.397933 / 0.323480 (0.074453) | 0.003455 / 0.007986 (-0.004531) | 0.002856 / 0.004328 (-0.001472) | 0.062938 / 0.004250 (0.058687) | 0.048896 / 0.037052 (0.011843) | 0.333070 / 0.258489 (0.074581) | 0.404485 / 0.293841 (0.110644) | 0.027156 / 0.128546 (-0.101390) | 0.007974 / 0.075646 (-0.067672) | 0.261505 / 0.419271 (-0.157766) | 0.045328 / 0.043533 (0.001795) | 0.311203 / 0.255139 (0.056064) | 0.390006 / 0.283200 (0.106806) | 0.023650 / 0.141683 (-0.118033) | 1.468856 / 1.452155 (0.016701) | 1.503867 / 1.492716 (0.011151) |

### 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.202110 / 0.018006 (0.184103) | 0.436433 / 0.000490 (0.435944) | 0.002278 / 0.000200 (0.002078) | 0.000070 / 0.000054 (0.000016) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.024575 / 0.037411 (-0.012836) | 0.073005 / 0.014526 (0.058479) | 0.083609 / 0.176557 (-0.092947) | 0.144881 / 0.737135 (-0.592254) | 0.083495 / 0.296338 (-0.212844) |

### 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.398911 / 0.215209 (0.183702) | 3.994035 / 2.077655 (1.916381) | 2.056768 / 1.504120 (0.552649) | 1.913242 / 1.541195 (0.372047) | 1.932934 / 1.468490 (0.464444) | 0.498953 / 4.584777 (-4.085824) | 3.031107 / 3.745712 (-0.714605) | 2.817165 / 5.269862 (-2.452696) | 1.858886 / 4.565676 (-2.706790) | 0.056977 / 0.424275 (-0.367299) | 0.006634 / 0.007607 (-0.000973) | 0.472580 / 0.226044 (0.246536) | 4.738301 / 2.268929 (2.469372) | 2.373938 / 55.444624 (-53.070686) | 2.021057 / 6.876477 (-4.855420) | 2.195419 / 2.142072 (0.053346) | 0.585182 / 4.805227 (-4.220045) | 0.124260 / 6.500664 (-6.376405) | 0.060250 / 0.075469 (-0.015219) |

### 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.227350 / 1.841788 (-0.614438) | 18.496525 / 8.074308 (10.422216) | 13.946658 / 10.191392 (3.755266) | 0.140024 / 0.680424 (-0.540399) | 0.017077 / 0.534201 (-0.517124) | 0.334415 / 0.579283 (-0.244868) | 0.351118 / 0.434364 (-0.083246) | 0.379556 / 0.540337 (-0.160782) | 0.525064 / 1.386936 (-0.861872) |

</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.006176 / 0.011353 (-0.005177) | 0.003648 / 0.011008 (-0.007360) | 0.063461 / 0.038508 (0.024953) | 0.062770 / 0.023109 (0.039660) | 0.448786 / 0.275898 (0.172888) | 0.486490 / 0.323480 (0.163010) | 0.005527 / 0.007986 (-0.002458) | 0.002860 / 0.004328 (-0.001469) | 0.063803 / 0.004250 (0.059553) | 0.049657 / 0.037052 (0.012604) | 0.449625 / 0.258489 (0.191136) | 0.489378 / 0.293841 (0.195537) | 0.028406 / 0.128546 (-0.100140) | 0.008062 / 0.075646 (-0.067584) | 0.068417 / 0.419271 (-0.350854) | 0.040854 / 0.043533 (-0.002678) | 0.461670 / 0.255139 (0.206531) | 0.481622 / 0.283200 (0.198423) | 0.021018 / 0.141683 (-0.120665) | 1.450328 / 1.452155 (-0.001826) | 1.501283 / 1.492716 (0.008567) |

### 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.269824 / 0.018006 (0.251817) | 0.412296 / 0.000490 (0.411807) | 0.039582 / 0.000200 (0.039382) | 0.000266 / 0.000054 (0.000211) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.026436 / 0.037411 (-0.010976) | 0.080633 / 0.014526 (0.066107) | 0.089786 / 0.176557 (-0.086770) | 0.145020 / 0.737135 (-0.592115) | 0.092327 / 0.296338 (-0.204012) |

### 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.464349 / 0.215209 (0.249140) | 4.630631 / 2.077655 (2.552976) | 2.560527 / 1.504120 (1.056407) | 2.374195 / 1.541195 (0.833000) | 2.424774 / 1.468490 (0.956284) | 0.510428 / 4.584777 (-4.074349) | 3.099805 / 3.745712 (-0.645907) | 2.781096 / 5.269862 (-2.488765) | 1.854276 / 4.565676 (-2.711400) | 0.058102 / 0.424275 (-0.366173) | 0.006365 / 0.007607 (-0.001242) | 0.534082 / 0.226044 (0.308038) | 5.355003 / 2.268929 (3.086074) | 3.012546 / 55.444624 (-52.432078) | 2.665222 / 6.876477 (-4.211255) | 2.821014 / 2.142072 (0.678942) | 0.597733 / 4.805227 (-4.207494) | 0.125433 / 6.500664 (-6.375231) | 0.060802 / 0.075469 (-0.014667) |

### 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.345699 / 1.841788 (-0.496088) | 18.836083 / 8.074308 (10.761774) | 14.895458 / 10.191392 (4.704066) | 0.146843 / 0.680424 (-0.533581) | 0.018082 / 0.534201 (-0.516119) | 0.335729 / 0.579283 (-0.243554) | 0.351013 / 0.434364 (-0.083351) | 0.388435 / 0.540337 (-0.151902) | 0.543826 / 1.386936 (-0.843110) |

</details>
</details>

![](https://cml.dev/watermark.png#d0c7e8c4808a1fb6ee7234b4caa25aa9fcfdc88f "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.006593 / 0.011353 (-0.004760) | 0.004089 / 0.011008 (-0.006919) | 0.084753 / 0.038508 (0.046245) | 0.079899 / 0.023109 (0.056790) | 0.311528 / 0.275898 (0.035630) | 0.349722 / 0.323480 (0.026243) | 0.004288 / 0.007986 (-0.003698) | 0.004552 / 0.004328 (0.000224) | 0.065896 / 0.004250 (0.061646) | 0.053813 / 0.037052 (0.016760) | 0.316958 / 0.258489 (0.058469) | 0.367011 / 0.293841 (0.073170) | 0.031082 / 0.128546 (-0.097464) | 0.008684 / 0.075646 (-0.066963) | 0.288003 / 0.419271 (-0.131268) | 0.052560 / 0.043533 (0.009027) | 0.305589 / 0.255139 (0.050450) | 0.349656 / 0.283200 (0.066457) | 0.023857 / 0.141683 (-0.117826) | 1.462360 / 1.452155 (0.010205) | 1.568170 / 1.492716 (0.075454) |

### 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.272342 / 0.018006 (0.254336) | 0.585108 / 0.000490 (0.584618) | 0.003427 / 0.000200 (0.003227) | 0.000078 / 0.000054 (0.000023) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.030347 / 0.037411 (-0.007064) | 0.086325 / 0.014526 (0.071799) | 0.100958 / 0.176557 (-0.075598) | 0.156534 / 0.737135 (-0.580601) | 0.102506 / 0.296338 (-0.193832) |

### 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.406625 / 0.215209 (0.191416) | 4.065957 / 2.077655 (1.988302) | 2.075867 / 1.504120 (0.571747) | 1.914390 / 1.541195 (0.373196) | 2.013321 / 1.468490 (0.544831) | 0.486832 / 4.584777 (-4.097945) | 3.545940 / 3.745712 (-0.199772) | 3.323226 / 5.269862 (-1.946635) | 2.067742 / 4.565676 (-2.497934) | 0.057884 / 0.424275 (-0.366391) | 0.007751 / 0.007607 (0.000144) | 0.484923 / 0.226044 (0.258878) | 4.844885 / 2.268929 (2.575956) | 2.569828 / 55.444624 (-52.874796) | 2.224058 / 6.876477 (-4.652419) | 2.485587 / 2.142072 (0.343515) | 0.584311 / 4.805227 (-4.220916) | 0.134984 / 6.500664 (-6.365680) | 0.062164 / 0.075469 (-0.013305) |

### 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.247182 / 1.841788 (-0.594605) | 20.107500 / 8.074308 (12.033192) | 14.194444 / 10.191392 (4.003052) | 0.147134 / 0.680424 (-0.533290) | 0.018062 / 0.534201 (-0.516138) | 0.392029 / 0.579283 (-0.187254) | 0.402991 / 0.434364 (-0.031373) | 0.457600 / 0.540337 (-0.082737) | 0.632553 / 1.386936 (-0.754383) |

</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.006920 / 0.011353 (-0.004433) | 0.004257 / 0.011008 (-0.006751) | 0.065233 / 0.038508 (0.026725) | 0.078151 / 0.023109 (0.055042) | 0.389141 / 0.275898 (0.113243) | 0.431518 / 0.323480 (0.108038) | 0.005752 / 0.007986 (-0.002234) | 0.003584 / 0.004328 (-0.000745) | 0.065173 / 0.004250 (0.060922) | 0.059113 / 0.037052 (0.022060) | 0.398225 / 0.258489 (0.139736) | 0.430980 / 0.293841 (0.137139) | 0.032802 / 0.128546 (-0.095744) | 0.008702 / 0.075646 (-0.066945) | 0.071345 / 0.419271 (-0.347926) | 0.048269 / 0.043533 (0.004736) | 0.389264 / 0.255139 (0.134125) | 0.416008 / 0.283200 (0.132809) | 0.024845 / 0.141683 (-0.116838) | 1.499100 / 1.452155 (0.046945) | 1.576397 / 1.492716 (0.083681) |

### 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.296674 / 0.018006 (0.278668) | 0.540108 / 0.000490 (0.539619) | 0.004293 / 0.000200 (0.004093) | 0.000151 / 0.000054 (0.000096) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.034108 / 0.037411 (-0.003303) | 0.092747 / 0.014526 (0.078221) | 0.112203 / 0.176557 (-0.064354) | 0.162728 / 0.737135 (-0.574407) | 0.109955 / 0.296338 (-0.186383) |

### 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.432006 / 0.215209 (0.216797) | 4.297591 / 2.077655 (2.219937) | 2.379645 / 1.504120 (0.875525) | 2.218680 / 1.541195 (0.677485) | 2.314608 / 1.468490 (0.846117) | 0.495562 / 4.584777 (-4.089215) | 3.589787 / 3.745712 (-0.155925) | 3.349593 / 5.269862 (-1.920268) | 2.119893 / 4.565676 (-2.445783) | 0.057976 / 0.424275 (-0.366299) | 0.007612 / 0.007607 (0.000005) | 0.509422 / 0.226044 (0.283378) | 5.101444 / 2.268929 (2.832515) | 2.794532 / 55.444624 (-52.650092) | 2.459033 / 6.876477 (-4.417444) | 2.714424 / 2.142072 (0.572352) | 0.588444 / 4.805227 (-4.216784) | 0.135763 / 6.500664 (-6.364901) | 0.062593 / 0.075469 (-0.012876) |

### 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.361415 / 1.841788 (-0.480372) | 20.940684 / 8.074308 (12.866376) | 15.161364 / 10.191392 (4.969972) | 0.154243 / 0.680424 (-0.526181) | 0.020305 / 0.534201 (-0.513896) | 0.397438 / 0.579283 (-0.181845) | 0.415047 / 0.434364 (-0.019317) | 0.473250 / 0.540337 (-0.067088) | 0.740681 / 1.386936 (-0.646255) |

</details>
</details>

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