So I have a dataset and it has a column which has data like this:
ID values
0001 [
{
prices: {
ia: '20K+',
ln: '3K-10K'
},
formats: [
'n',
'ia'
],
id: 'c8f4f498-1cfeaf1-455a-a5ac-310191wefw959583',
image_url: 'file.jpg',
slug: 'test1'
},
{
prices: {
ia: '20K+',
ln: '3K-10K'
},
formats: [
'n',
'ia'
],
id: 'c8f4f4wfwe98-1ca1-455a-a5ac-3101919wfewf59583',
image_url: 'file.jpg',
slug: 'test3'
}
]
0002 [
{
prices: {
ia: '20K+',
ln: '3K-10K'
},
formats: [
'n',
'ia'
],
id: 'c8f4feeee498-1ca1-455a-a5ac-3101919fwewf59583',
image_url: 'file.jpg',
slug: 'test2'
}
All I care about in this variable is the slug
. But different ID's have different number of slugs. How could I get a new df from this data to show me every slug as well as the count.
So the result I want:
ID slugs slug_count
0001 ['test1','test3'] 2
0002 ['test2'] 1
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.