BUG: concat of Series w/o names #10698
State: closed

closes #10698 

Let the result of 'concat' to inherit the parent Series' names. The Series' name (if present) will be used as the resulting DataFrame column name. When only one of the Series has a valid name, the resulting DataFrame will inherit the name only, and use a column name for the other columns the column index value.


Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode

Comments:
here are some helpful hints FYI: http://pandas.pydata.org/pandas-docs/stable/contributing.html

Apologies I pushed a few "fixes" for some unit tests which were failing. Looking at the reason why those tests were failing I've noticed it was because of the use of the argument 'keys' in the function 'concat'. Most people are using it to pass the column names, which is something I personally don't do and therefore I didn't consider when writing the code. I'm going to reset my local branch to commit 'b9cba86ec1c11c200c44c62d0a300b7f326a12e4' and make the necessary changes to allow this case. Before sending the next pull request I'm going to make sure all nosetests pass correctly. This should also fix the build issue. Apologies again, this is due to lack of experience. I'll make sure to learn from my mistake.

@jreback Thanks for spending the time to review my pull request. I'm going to start working on another bug now.  

pls add a whatsnew note. This is just a bug fix, but I think should have a mini-example. pls have squash as well.

I think I made a mistake. I rebased my local version because was missing some of the recent updates in the upstream version and (after solving some merging conflicts) I pushed. I see there is an alert message saying "This branch has conflicts that must be resolved" on my pull request in GitHub. Apologies for that. Is there a way I can solve this?

you need to rebase / squash. If you have a conflict it will show up when you do this. Conflicts are normal and happen because others have changed code that you are changing. See the contributing docs [here](http://pandas.pydata.org/pandas-docs/stable/contributing.html)

Okay! So it should be fine right? 

Conflicts are fine, as in they're not a sign you've done anything wrong. But they do need to be resolved before merge - the docs describe how to squash & merge. Cheers

Okay guys, I think I did it. Please let me know if I did something wrong. Apologies again for my lack of experience.

might need a doc-example http://pandas.pydata.org/pandas-docs/stable/merging.html#more-concatenating-with-group-keys to explain how `keys` overrides this (and add a test as well)

can you update and add a doc example?

Sure! I think I messed up with my branch because lots of test are failing after I rebased last day. I'll fix this ASAP.

I see the branch has conflicts. I'm assuming in this sort of situations I need to fix those myself right?

In the effort of solving them using `git mergetool` I've noticed that sometimes there are pieces of code in my LOCAL branch which are not present in the REMOTE, but I haven't create them myself. What I usually do is to update my master branch:

```
# go to the master branch
git checkout master
# pull changes from github
git fetch upstream
# update the master branch
git rebase upstream/master
# push it to your Github repo
git push
```

Then I update the local branch:

```
# go to the feature branch
git checkout my-new-feature
# make a backup in case you mess up
git branch tmp my-new-feature
# rebase on master
git rebase master
```

The `rebase` will fail and suggest me to use `mergetool` to solve the conflicts manually. Now, how should I behave in situations like the one in the attached picture?

![screenshot from 2015-08-19 08 42 41](https://cloud.githubusercontent.com/assets/4025968/9351185/3cc512ba-464f-11e5-978b-c8c8a4278ecd.png)

In the picture above the document on the left is my local, the one in the middle is the result of the merge, and the one on the right is the remote. In this occasions I tend to pick from the remote everything I don't have in my local branch, because I assume these are coming from other submitted pull requests or code merged while I was working on my local branch. What about the code which is in my local, hasn't been written by me, and is not in the remote?  Should I discard it?

need to rebase / squash. generally you won't have conflicts. other people add code and should be straightforward to accept.

Seems you have a bit too much changes in the whatsnew file?

Joris, my bad, I messed up when merging. I think I've solved all the issues now. 

can you update according to comments

@IamGianluca awesome job! thanks!