I need to replace the character “[” in a python string generated by instrument software. The script that I’ve been using recently started throwing a syntax warning.
I’ve been doing this in a script using:
cols[0] = cols[0].str.strip().str.replace('[.*]','',regex=True)
which works, but now gives the warning:
SyntaxWarning: invalid escape sequence ‘[‘
I’ve read that this will become an error in the future. How can I avoid this?