2

I have a column containing strings in this format:

/* [MCCOOK 0     ] */,999990,'MCCOOK  0   '

I want to extract the substring between [ and ] into another column. Please advise.

Shyama Sonti
  • 261
  • 1
  • 3
  • 15

1 Answers1

7

As suggested in this answer https://stackoverflow.com/a/16842576/9754169 you can use the apply approach

your_column.apply(lambda st: st[st.find("[")+1:st.find("]")])
Yuca
  • 5,558
  • 3
  • 21
  • 39