Create Attribute of Comma Seperated Values [duplicate]
This question already has an answer here:
How to use groupby to concatenate strings in python pandas?
1 answer
Pandas groupby: How to get a union of strings
6 answers
I have a loans dataset and each row represents a loan plan and has a customer ID associated with it.
Loan_ID Customer_ID
1 A
2 B
3 A
4 C
5 A
6 C
I want to create a seperate table which will be grouped by Customer_ID and will contain an attribute that is a comma seperated list of the Loan_ID.
Customer_ID Loan_ID_List
A 1,3,5
B 2
C 4,6
python pandas
marked as duplicate by user3483203
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 14 '18 at 18:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to use groupby to concatenate strings in python pandas?
1 answer
Pandas groupby: How to get a union of strings
6 answers
I have a loans dataset and each row represents a loan plan and has a customer ID associated with it.
Loan_ID Customer_ID
1 A
2 B
3 A
4 C
5 A
6 C
I want to create a seperate table which will be grouped by Customer_ID and will contain an attribute that is a comma seperated list of the Loan_ID.
Customer_ID Loan_ID_List
A 1,3,5
B 2
C 4,6
python pandas
marked as duplicate by user3483203
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 14 '18 at 18:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)
– user3483203
Nov 14 '18 at 18:18
add a comment |
This question already has an answer here:
How to use groupby to concatenate strings in python pandas?
1 answer
Pandas groupby: How to get a union of strings
6 answers
I have a loans dataset and each row represents a loan plan and has a customer ID associated with it.
Loan_ID Customer_ID
1 A
2 B
3 A
4 C
5 A
6 C
I want to create a seperate table which will be grouped by Customer_ID and will contain an attribute that is a comma seperated list of the Loan_ID.
Customer_ID Loan_ID_List
A 1,3,5
B 2
C 4,6
python pandas
This question already has an answer here:
How to use groupby to concatenate strings in python pandas?
1 answer
Pandas groupby: How to get a union of strings
6 answers
I have a loans dataset and each row represents a loan plan and has a customer ID associated with it.
Loan_ID Customer_ID
1 A
2 B
3 A
4 C
5 A
6 C
I want to create a seperate table which will be grouped by Customer_ID and will contain an attribute that is a comma seperated list of the Loan_ID.
Customer_ID Loan_ID_List
A 1,3,5
B 2
C 4,6
This question already has an answer here:
How to use groupby to concatenate strings in python pandas?
1 answer
Pandas groupby: How to get a union of strings
6 answers
python pandas
python pandas
asked Nov 14 '18 at 18:14
Briain O DonnellBriain O Donnell
1339
1339
marked as duplicate by user3483203
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 14 '18 at 18:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by user3483203
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Nov 14 '18 at 18:16
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)
– user3483203
Nov 14 '18 at 18:18
add a comment |
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)
– user3483203
Nov 14 '18 at 18:18
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)– user3483203
Nov 14 '18 at 18:18
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)– user3483203
Nov 14 '18 at 18:18
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
df.astype(str).groupby('Customer_ID')['Loan_ID'].agg(','.join)– user3483203
Nov 14 '18 at 18:18