How to replace all instances of /N with NaN in a csv file using Python
Solution 1:
Python uses backslashes as a symbol to signify escape sequences like newlines, tabs, quotes, etc. So if you want to use backslashes in a string, you must replace all the single backslashes with double backslashes, like so;
df.replace('\\N', 'NaN')