BUG: assign consensus name to index union in array case GH13475
- [x] closes #13475
- [x] tests added / passed (except known datetime64 issue in #35080)
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Sure thing! Just added in a test ensuring a common index name is preserved with concat. Sounds great, thanks! Just added the new tests. I figured since we're primarily testing the index name functionality, it's okay to define the base frame then use `rename_axis` to differentiate. > this also needs a whatsnew note, this would be for 1.2 (the whatsnew is not pushed yet so will have to do a bit later)

@iamlemec 1.2 whatsnew is on master now Congrats on the release!

Actually, I was going over the testing code one last time, and I realized it doesn't actually test the new behavior (put another way, the current master will pass the test). That's because the bug only kicks in when the indices aren't equal (numerically), but they are equal in the test. I'm going to change it so the indices are only partially overlapping. Should I still also test the case where they are numerically equal?

One more thing, which I think hasn't been brought up explicitly. This fix will also affect the behavior of the DataFrame constructor in the same way it affects concat with axis=1. Not sure if this influences the testing requirements. > One more thing, which I think hasn't been brought up explicitly. This fix will also affect the behavior of the DataFrame constructor in the same way it affects concat with axis=1. Not sure if this influences the testing requirements.

can you show an example? Sure thing. The original issue only arises when it hits the "array" case of `union_indexes`, which means we need to send it a plain `Index`, so I'm using string index labels here:

```
s1 = pd.Series([1, 2], index=pd.Index(['a', 'b'], name='idx'))
s2 = pd.Series([2, 3], index=pd.Index(['b', 'c'], name='idx'))
pd.DataFrame({'a': s1, 'b': s2})
```

On master, I'm getting this yielding a DataFrame whose index has no name. With patch, it's named 'idx'. > Sure thing. The original issue only arises when it hits the "array" case of `union_indexes`, which means we need to send it a plain `Index`, so I'm using string index labels here:
> 
> ```
> s1 = pd.Series([1, 2], index=pd.Index(['a', 'b'], name='idx'))
> s2 = pd.Series([2, 3], index=pd.Index(['b', 'c'], name='idx'))
> pd.DataFrame({'a': s1, 'b': s2})
> ```
> 
> On master, I'm getting this yielding a DataFrame whose index has no name. With patch, it's named 'idx'.

great, can you add this as a test as well; let's put it in the pandas/tests/frame/test_constructors.py, ping on green. Sounds good @jreback. Just pushed a DataFrame constructor test. great ping on green @jreback ok everything on CI looks good except for `test_chunks_have_consistent_numerical_type`, but it seems like that one's been flakey for people lately yep that's fine, thanks @iamlemec 