Wireshark mailing list archives
Re: CSV data and decimal separators
From: Guy Harris <guy () alum mit edu>
Date: Wed, 19 Nov 2014 20:05:11 -0800
On Nov 19, 2014, at 6:20 PM, Guy Harris <guy () alum mit edu> wrote:
What do various programs do when reading comma-separated value files if: 1) the file contains floating-point values and 2) the locale in which the program is being run uses comma, rather than period, as the decimal separator?
From a quick experiment, using Excel for Mac 2011, with a locale temporarily tweaked to use , as the decimal separator and . as the thousands separator, the wizard for importing data, if I try to import a CSV file, offers an option (under "Advanced..." in step 3 of the import wizard) to, on a per-column basis, control what characters to use as decimal and thousands separators when importing the file. It offers , as a decimal separator and . as a thousands separator by default in that case.
With the default settings, importing a file with: 5.3,hello,goodbye,2.18281828 results in cell A1 containing the text "5.3". Setting cell A2 to "=A1+10" causes a value error. Changing cell A1 to "5,3" causes cell A2 to contain "15,3". Saving the spreadsheet as a "Windows CSV" file apparently spells "semicolon" with an initial "C", as the file was written out as a *semicolon*-separated file, with commas as decimal separators and periods as thousands separators. Importing with . as the decimal separator and , as the thousands separator results in cell A1 containing the text "5,3", which is correctly treated as 5 and 3/10ths. ___________________________________________________________________________ Sent via: Wireshark-users mailing list <wireshark-users () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-users Unsubscribe: https://wireshark.org/mailman/options/wireshark-users mailto:wireshark-users-request () wireshark org?subject=unsubscribe
Current thread:
- CSV data and decimal separators Guy Harris (Nov 19)
- Re: CSV data and decimal separators Guy Harris (Nov 19)
- Re: CSV data and decimal separators Guy Harris (Nov 20)
- Re: CSV data and decimal separators Guy Harris (Nov 20)
- Re: CSV data and decimal separators Guy Harris (Nov 21)
- Re: CSV data and decimal separators Guy Harris (Nov 21)
- Re: CSV data and decimal separators Guy Harris (Nov 20)
- Re: CSV data and decimal separators Guy Harris (Nov 19)
- Re: CSV data and decimal separators Guy Harris (Nov 20)
- Re: CSV data and decimal separators Guy Harris (Nov 19)
- Re: CSV data and decimal separators Andrew Hood (Nov 20)