I'm using Jupyter notebooks to join two data frames together and I'm getting the following error. Does anyone know the right way to write this?
ValueError: Can only compare identically-labeled Series objects
data_set = git_author.join(repo_team, on=git_author.project==repo_team.gitProject)
You error ValueError: Can only compare identically-labeled Series objects
comes from the fact there is not a column with the same label in both data frames that you can use with a key. Then, I suggest using:
data_set = git_author.merge(repo_team, right_on = "project", left_on = "gitProject")
Additionally, you can specify the how
parameter to tell merge whether you want to do an inner join, outer join, left join or right join.
This way, you can specify the label of the column to be used as a key on the merge, even though that label is different for both data frames.
NB: since I don't have your data, it has not been tested.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.