I've got a Dataframe containing strings like this
| A header | Another header |
|---|---|
| First | row |
| Second | row |
| [First] nenen | row |
| [Second] mmm | row |
I want to remove all the text in brackets ([xxx]) and keep the rest of the string in each row.
How can I do that?
I've got a Dataframe containing strings like this
| A header | Another header |
|---|---|
| First | row |
| Second | row |
| [First] nenen | row |
| [Second] mmm | row |
I want to remove all the text in brackets ([xxx]) and keep the rest of the string in each row.
How can I do that?
>>> df
a header another header
0 first row
1 [First] second row
>>> df["a header"]=df["a header"].str.replace(r'\[.*?\]\ *','')
>>> df
a header another header
0 first row
1 second row