mgastner / cartogram-cpp

Cartogram generator in C++
MIT License
8 stars 4 forks source link

Inability of code to read csv values formatted in categories other than General #137

Closed edliau closed 5 months ago

edliau commented 2 years ago

Running the cartogram function will return an error stating "Areas must be numeric or NA" when the target CSV file has its data formatted in categories other than General under "Format cells..." Maybe the code can be changed to accept values such as "Numbers" and "Custom".

mgastner commented 2 years ago

I am uncertain what you mean. CSV files are plain-text files, so entries have no connotation of being "Numbers" or "General". Would you mind elaborating?

edliau commented 2 years ago

I've attached some images below to more clearly demonstrate how this issue can be reproduced. I think the main issue is when data is formatted with the "1000 separator(,)", Excel actually physically inserts these commas if the data is used as inputs for anything else, despite the actual data not having any commas in it (as pictured in screenshot 3). While most other formatting settings are typically lost upon closing the file due to its plain-text nature, Excel appears to retain these settings.

Screenshot 2022-07-03 151714 Screenshot 2022-07-03 151852 Screenshot 2022-07-03 152255

I suppose the edit in this case would either be adjusting documentation to warn users of this issue, or somehow accept comma-separated values as input.