DOC: update str.cat example
State: closed

There have been a couple of changes recently due to the whole docstring validation effort (e.g. #22838), which got rid of some warnings emitted by the sample code.

As it stands, the code samples don't really reflect the running text anymore, and with the changes from #22264, it makes sense to update the running text as well.

Labels:
name: Docs
name: Strings
description: String extension data type and string data

Comments:
Just realised while double-checking the code locally that there's `still` a `FutureWarning`, which did not get caught by any test after the `pd.concat(sort=...)`-transition, because it was being shadowed by the `FutureWarning` for `join is None`.

In other words, the doc build here will have a warning (=fail?), until #23725 is merged.
Ok, the build didn't fail - it's just a flaky hypothesis failure.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23723?src=pr&el=h1) Report
> Merging [#23723](https://codecov.io/gh/pandas-dev/pandas/pull/23723?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/6249355b853878ff06ad8d2affe00d3b629a36ea?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #23723   +/-   ##
=======================================
  Coverage   92.38%   92.38%           
=======================================
  Files         166      166           
  Lines       52490    52490           
=======================================
  Hits        48493    48493           
  Misses       3997     3997
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.81% <ø> (ø)` | :arrow_up: |
| #single | `43.05% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23723?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/23723?src=pr&el=footer). Last update [6249355...3f8d4fd](https://codecov.io/gh/pandas-dev/pandas/pull/23723?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

this example still is a bit complicated. can you simplify at all.
I don't like the example too much either, especially initialising the ndarray directly. After all, what I want to do is change the index of `s` to be the same as its values (due to alignment, as I note in the running test). For this, it might make sense to wait for #22225, because then it would be very easy:

```python
>>> s2 = s.set_index(s.values)
>>> s2
a    a
b    b
c    c
d    d
dtype: object
>>> u2 = u.set_index(u.values)
>>> u2
b    b
d    d
a    a
c    c
dtype: object
>>> idx = pd.Index(['d', 'c', 'b', 'a'])
>>> idx
Index(['d', 'c', 'b', 'a'], dtype='object')
>>> u_values = u.values
>>> u_values
array(['b', 'd', 'a', 'c'], dtype=object)
>>> s2.str.cat([u2, idx, u_values], join='left')
a    aaab
b    bbbd
c    ccca
d    dddc
dtype: object
```
can you merge master and will look
@jreback 
Could you have a look at  #24046? #22225 is essentially ready and would make things much easier here.

I'll merge in master later.
@jreback 
Incorporated your feedback (removed `Index` from example pending progress on #22225, as the extra complexity to align an index without having `Series.set_index` bloated the example).

It's all green, except for #24564
@WillAyd 
Your review is outdated, would you care to comment (or at least remove the change request), please?
thanks @h-vetinari