BUG (output formatting): use fixed with for truncation column instead of inferring from last column
State: closed

Fixes https://github.com/pandas-dev/pandas/issues/24849

We were using the last column to infer the width of the truncation column (= the column with all the `...` if not all columns are shown). This gives wrong results in case the last column is very wide, and since the content of this columns is always fixed to `...`, we can also use a fixed width I think.

Labels:
name: Bug
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
And a wide last column is quite typical in geopandas .. ;)
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=h1) Report
> Merging [#24905](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/94d989e4ae682bbd39f5599ef1d1f455bea0c3fd?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24905/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24905      +/-   ##
==========================================
- Coverage   92.39%   92.39%   -0.01%     
==========================================
  Files         166      166              
  Lines       52413    52411       -2     
==========================================
- Hits        48425    48423       -2     
  Misses       3988     3988
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.81% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.88% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/24905/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.98% <100%> (-0.01%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=footer). Last update [94d989e...e7c666c](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=h1) Report
> Merging [#24905](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/94d989e4ae682bbd39f5599ef1d1f455bea0c3fd?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24905/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24905      +/-   ##
==========================================
- Coverage   92.39%   92.39%   -0.01%     
==========================================
  Files         166      166              
  Lines       52413    52411       -2     
==========================================
- Hits        48425    48423       -2     
  Misses       3988     3988
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.81% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.88% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/24905/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.98% <100%> (-0.01%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=footer). Last update [94d989e...e7c666c](https://codecov.io/gh/pandas-dev/pandas/pull/24905?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

All green. Merge whenever you're ready @jorisvandenbossche.