I have a pd dataframe which looks like this:
    keyword     |    ranks    |search_type | search_volume
0   keyword1    |[{'rank': 1}]| 1          | {'search_volume': 10}
1   keyword1    |[{'rank': 1}]| 2          |{'search_volume': 10}
2   keyword2    |[{'rank': 1}]| 1          |{'search_volume': 390}
3   keyword2    |[{'rank': 1}]| 2          |{'search_volume': 390}
4   keyword3    |[{'rank': 1}]| 1          |{'search_volume': 170}
...
Columns ranks and search_volume should be integers containing numbers only, and I'm trying to find a way to remove [{'rank': , {'search_volume': and and closing brackets, so the table looks like:
    keyword     | ranks |search_type | search_volume
0   keyword1    |   1   |   1        |10
1   keyword1    |   1   |   2        |10
2   keyword2    |   1   |   1        |390
3   keyword2    |   1   |   2        |390
4   keyword3    |   1   |   1        |170
...
I've tried this: df['ranks'].replace('[{\'rank\':','',inplace=True) however it didn't do anything. also this is not the quickest way of solving this problem.
I've had a look at this thread Pandas DataFrame: remove unwanted parts from strings in a column, this solution is for one column at a time (it would be good to strip out out all unwated strings at once) and it returns this error: AttributeError: 'list' object has no attribute 'lstrip'.
I'm using python 3.
 
     
    