Remove illegal file name characters from pandas dataframe column using python
I will do this. You can add as many characters as you want.
dataframe['filenames'] = dataframe['filenames'].str.replace('?|/', '', regex=True)
You need to separate characters you want to remove by '|'.
I have a pandas dataframe which has a column called filenames which contains the names which will be used to save certain objects into csv files. However, many of them contain illegal characters like “?” Or “/“, is there a quick way to remove all of them ?
I tried dataframe['filenames'] = dataframe['filenames'].str.strip('?/')  but nothing happens. The characters are still there, what’s the more efficient and safe way to do this?