Pandas to_csv with quoting=3 (QUOTE_NONNUMERIC) doesn't work
pandas, python
Solution
It seems like the value in the `csv` library has changed since these docs were written. Rather than use the magic number `3`, use `csv.QUOTE_NONNUMERIC` to be safe...
>>> import csv
>>> csv.QUOTE_NONNUMERIC
2
In full:
table.to_csv("myfile.csv", quoting=csv.QUOTE_NONNUMERIC)
Problem
From the docs regarding `to_csv()` and others: quoting : int, Controls whether quotes should be recognized. Values are taken from csv.QUOTE_* values. Acceptable values are 0, 1, 2, and 3 for QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONE, and QUOTE_NONNUMERIC, respectively. Setting `quoting=3` still does not quote strings even if they're not numeric, and `libreoffice` is constantly defaulting to splitting by spaces which I never realise until its too late. How can I write CSV, quoting strings with spaces correctly?