Groups
Sign in
Groups
julia-users
Conversations
About
Send feedback
Help
join dataframe columns
94 views
Skip to first unread message
pip7...@gmail.com
unread,
Feb 28, 2015, 5:35:01 PM
2/28/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Hi
How can I join 2 columns in a dataframe.
e.g.
Dataframe 1
Row Name Name2 Amt
1 Test A 123
2 Test2 B 456
etc
I want to be able to join Name and Name2 and use a separator like -
eg
Row Name Amt
1 Test-A 123
2 Test2-B 456
Regards
Johan Sigfrids
unread,
Mar 1, 2015, 9:50:42 AM
3/1/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
With a DataFrame like:
df = DataFrame(Name = ["Test", "Test2"], Name2 = ["A", "B"], Amt=[123,456])
you could do something like this:
df[:Name] = map((x,y) -> string(x, -, y), df[:Name], df[:Name2])
Note that you will still have the
Name2
column.
pgs
unread,
Mar 2, 2015, 6:47:16 AM
3/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to julia...@googlegroups.com
Johan
Thanks for this.
I also found that I could use .* to join two columns in a DataFrame.
Using a dot star to join! - I found surprising - but it worked.
Regards
Reply all
Reply to author
Forward
0 new messages