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.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 28986489 โ€บ how-to-replace-text-in-a-string-column-of-a-pandas-dataframe
python - How to replace text in a string column of a Pandas dataframe? - Stack Overflow
I have a column in my dataframe like this: range "(2,30)" "(50,290)" "(400,1000)" ... and I want to replace the , comma with - dash. I'm currently using this method ...
๐ŸŒ
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.
๐ŸŒ
Pandas
pandas.pydata.org โ€บ pandas-docs โ€บ stable โ€บ reference โ€บ api โ€บ pandas.DataFrame.replace.html
pandas.DataFrame.replace โ€” pandas 3.0.5 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.
๐ŸŒ
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
๐ŸŒ
Medium
medium.com โ€บ data-science โ€บ an-easy-way-to-replace-values-in-a-pandas-dataframe-2826bd34e59a
An Easy Way to Replace Values in a Pandas DataFrame | by Byron Dolon | TDS Archive | Medium
July 25, 2021 - To do this, Pandas provides a wide range of methods that you can use to work with columns of all data types in your DataFrames. In this piece, letโ€™s take a look specifically at replacing values and sub-strings within columns in a DataFrame.