Попробуйте использовать это:
def cust_func(data):
## split the transcription with , delimitter - later we will join
words = data.split(",")
## get index of words which are completely in uppercase and also endswith :,
column_idx = []
for i in range(len(words)):
if ((words[i].endswith(":") or words[i].endswith(": ")) and words[i].isupper()):
column_idx.append(i)
## Find the sentence for each of the capital word by joining the words
## between two consecutive capital words
## Save the cap word and the respective sentence in dict.
result = {}
for i in range(len(column_idx)):
if i != len(column_idx)-1:
result[words[column_idx[i]]] = ",".join(words[column_idx[i]+1:column_idx[i+1]])
else:
result[words[column_idx[i]]] = ",".join(words[column_idx[i]+1:])
return(pd.Series(result)) ## this creates new columns
df = pd.concat([df, df.transcription.apply(cust_func)], axis=1)
df
Вывод выглядит следующим образом (Не удалось захватить все столбцы на одном снимке экрана.):
![enter image description here](https://i.stack.imgur.com/HgjMA.png)