problem
What does quoting = 3 mean in pd.read_csv function of pandas?
Create a new test.txt file with the following content:
Haha
haha
"haha"
"haha"
"ha
ha"
"ha
ha"
Code:
import pandas as pd
t = pd.read_csv('test.txt', header=None, sep='\t')
print(t)
Output result:
You can see that the English quotation marks are gone. Double quotation marks will only print the content inside the quotation marks, and only the content of single quotation marks will print abnormally.
Change the test.txt code:
import pandas as pd
t = pd.read_csv('test.txt', header=None, sep='\t', quoting = 3)
print(t)
Code output result:
You can see all the content is printed truthfully
in conclusion
If quoting is not set, the English double quotation marks will be removed by default, and only the content in the English double quotation marks will be left. If quoting = 3, the content will be read truthfully.