Try this:

data['q3'] = data['q3'].str.replace('[', '').replace(']','')
Answer from cteljr on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ replace-characters-in-strings-in-pandas-dataframe
Replace Characters in Strings in Pandas DataFrame - GeeksforGeeks
July 23, 2025 - We can replace characters using str.replace() method is basically replacing an existing string or character in a string with a new one. we can replace characters in strings is for the entire dataframe as well as for a particular column.
๐ŸŒ
DataScientYst
datascientyst.com โ€บ replace-text-pandas-dataframe-column
How to Replace Text in a Pandas DataFrame Or Column
November 2, 2021 - Replace text is one of the most popular operation in Pandas DataFrames and columns. In this post we will see how to replace text in a Pandas. The short answer of this questions is: (1) Replace character in Pandas column df['Depth'].str.replace('.',',') (2) Replace text in the whole
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.DataFrame.replace.html
pandas.DataFrame.replace โ€” pandas 3.0.6 documentation
For a DataFrame a dict can specify that different values should be replaced in different columns. For example, {'a': 1, 'b': 'z'} looks for the value 1 in column โ€˜aโ€™ and the value โ€˜zโ€™ in column โ€˜bโ€™ and replaces these values with whatever is specified in value.
๐ŸŒ
Erikrood
erikrood.com โ€บ Python_References โ€บ find_replace_col.html
Finding and replacing characters in Pandas columns
import pandas as pd import numpy as np ยท raw_data = {'name': ['Willard Morris', 'Al Jennings', 'Omar Mullins', 'Spencer McDaniel'], 'age': [20, 19, 22, 21], 'favorite_color': ['blue', 'red', 'yellow', "green"], 'grade': [88, 92, 95, 70]} df = pd.DataFrame(raw_data, index = ['Willard Morris', 'Al Jennings', 'Omar Mullins', 'Spencer McDaniel']) df ยท df.columns = [x.strip().replace('_', '_TEST_') for x in df.columns] df.head()
๐ŸŒ
IncludeHelp
includehelp.com โ€บ python โ€บ pandas-replace-a-character-in-all-column-names.aspx
Python - Pandas replace a character in all column names
July 30, 2022 - To replace a character in all column names in pandas DataFrame, you can use the df.columns.str.replace() method by specifying the old and new character to be replaced as the parameters of the function.
๐ŸŒ
Pandas
pandas.pydata.org โ€บ docs โ€บ reference โ€บ api โ€บ pandas.Series.str.replace.html
pandas.Series.str.replace โ€” pandas 3.0.6 documentation
Replace each occurrence of pattern/regex in the Series/Index. Equivalent to str.replace() or re.sub(), depending on the regex value. ... String can be a character sequence or regular expression.
๐ŸŒ
InterviewQs
interviewqs.com โ€บ ddi-code-snippets โ€บ find-replace-col
Find and replace characters in Pandas dataframe columns - InterviewQs
A step-by-step Python code example that shows how to find and replace characters in a Pandas DataFrame column header. Provided by InterviewQs, a mailing list for coding and data interview problems.
Find elsewhere
๐ŸŒ
Quora
quora.com โ€บ How-can-I-replace-characters-in-a-multiple-column-name-in-pandas
How to replace characters in a multiple column name in pandas - Quora
Df ['column'].str.replace is not working. ... I have a column in Pandas DataFrame that contains characters, how to convert these characters into float values?
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ how to replace string in pandas dataframe
How to Replace String in Pandas DataFrame - Spark By {Examples}
June 13, 2025 - In pandas, to replace a string in the DataFrame column, you can use either the replace() function or the str.replace() method along with lambda methods.
๐ŸŒ
DataScience Made Simple
datasciencemadesimple.com โ€บ home โ€บ replace substring/pattern of column in pandas python
Replace substring/pattern of column in pandas python - DataScience Made Simple
July 28, 2023 - In this example we will be replacing a pattern on entire dataframe, India is replaced with IND in the entire dataframe across all columns as shown below. ### Replace a Pattern of entire dataframe pandas df2=df1.replace(regex=['India'],value='IND') df2
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ 2 different replace functions of python pandas
2 Different Replace Functions of Python Pandas | Towards Data Science
January 20, 2025 - Accessors in Pandas provide functions specific to a particular data type. The str accessor is the one for string operations. The "str.replace" function can be used for replacing a character in a string.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ pandas โ€บ pandas replace substring in dataframe
Pandas Replace Substring in DataFrame - Spark By {Examples}
June 6, 2025 - You can find how to replace substrings in a pandas DataFrame column using the replace() method with lambda functions. This versatile method allows you to
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ data analysis โ€บ python-pandas-dataframe-replace
Python | Pandas dataframe.replace() - GeeksforGeeks
Pandas dataframe.replace() function is used to replace a string, regex, list, dictionary, series, number, etc. from a Pandas Dataframe in Python.
Published: July 11, 2025