Writing a comma-separated file from a pandas DataFrame

To write a comma-separated file containing data on vitamins from the DataFrame created in this Example to_csv can be used as follows:

df.to_csv('vitamins.csv', float_format='%.1f', columns=['Solubility', 'RDA'])

The file written is:

Vitamin,Solubility,RDA
A,Fat,800.0
B1,Water,1150.0
B2,Water,1200.0
B3,Water,15000.0
B5,Water,5000.0
B6,Water,1450.0
B7,Water,30.0
B9,Water,400.0
B12,Water,2.4
C,Water,82500.0
D,Fat,15.0
E,Fat,15000.0
K,Fat,115.0