Я считаю, что вам нужно для strings
findall
с join
:
df['b'] = df['Data'].str.findall('(\[.*?\])').str.join(', ')
print (df)
Record Data \
0 1 Rohan is [age:10] with [height:130 cm].
1 2 Girish is [age:12] with [height:140 cm].
2 3 Both kids live in [location:Punjab] and [Delhi].
3 4 They love to play [Sport:Cricket] and [Sport:F...
b
0 [age:10], [height:130 cm]
1 [age:12], [height:140 cm]
2 [location:Punjab], [Delhi]
3 [Sport:Cricket], [Sport:Football]
Если нужны значения в lists
:
df['b'] = df['Data'].str.findall('\[(.*?)\]')
print (df)
Record Data \
0 1 Rohan is [age:10] with [height:130 cm].
1 2 Girish is [age:12] with [height:140 cm].
2 3 Both kids live in [location:Punjab] and [Delhi].
3 4 They love to play [Sport:Cricket] and [Sport:F...
b
0 [age:10, height:130 cm]
1 [age:12, height:140 cm]
2 [location:Punjab, Delhi]
3 [Sport:Cricket, Sport:Football]