I would like to read some gz files by pandas, in which data are split by '', in python 3.
If I use the code:
pd.read_csv('my file.gz',sep='\')
I will get the error "EOL while scanning string literal".
What is the correct way to do this?
pd.read_csv('my file.gz',sep='\\') # use \\ instead of \
Sometimes csv file uses a specific separator, such as \t (TAB), instead of a comma(,). In this case, if the csv file use \ as a separator, you have to use \\ instead of \ because \ is an escape character.
There are many other special characters that require escape character \, such as \t (TAB), \\ (BACKSLASH), and \ (Single Quote).
You can see more information about ESCAPE here: https://www.w3schools.com/python/gloss_python_escape_characters.asp