Factsheet
What are CSV files and how they be used along with python?
ELI5: What is CSV fiels
Excel and CSV files - Are there different types of *.csv files?
How to open large .CSV file? (2GB)
Videos
Just started a course in Machine learning I am given a few data sets that usually in CSV files, why?
Hey,
I see recently many people talk about csv files, and i'm trying to figure why they are more useful or just the differences between them and excel files
Thanks!
A CSV file is (by strict definition) a TXT file with comma separated values. In reality, there are many different characteres used as the delimiter of the values; a semi-colon (;), tab or a pipe (|) being a couple of more common.
The encapsulator is most commonly a full quote ("). A pair of these are used to wrap text fields that may or may not contain the character used as the delimiter. You have to be careful that a full quote does not appear within the wrapping quotes or the result is malformed garbage.
Other than that, a CSV is a CSV. Different programs will use different rules to import a CSV and you often have to tailor the CSV file to suit. Excel's import from text (Data tab, Get External Data, From Text) allows for various deliminator characters as well as different encapsulator characters. You can also specify text input on a particular field of information so a large number remains as a large number and is not converted to scientific notation.
total1 wrote:
I've created an *.csv file for importing into an application but the csv file won't import properly. I have to put quotes around the import fields due to commas being a 'possible' part of an address like "123 E Main St., Apt. 100B". Without commas the import performs properly.
[....]
The problem seems to be that the application canโt import it in a standard txt/csv file. There has to be a code missing somewhere or an extra code somewhere, but I canโt see it. It works great if it reads it as an Excel csv file.
Are all *.csv files created equal or is there a 'special' *.csv from Excel?
There may be several factors in play here.
First, when you do Save As in Excel, you will see several "different" CSV options. I have not experimented to see their differences. I suspect (but don't know for sure) that the difference between CSV and CSV(Macintosh) is the line terminator (CR, LF, CR LF or LF CR). And IIRC, there is only a subtle difference between CSV and CSV(MS-DOS) which probably does not apply to you. (Do a Google search.)
Second, despite the name (comma-separated values), I believe the actual separator used depends the settings in the Region and Language Option control panel. The exporting application and importing application must agree.
Finally, there really are no standards for the CSV file format. There is an "RFC", an attempt to describe a standard. But it is really post-facto to most implementations. Moreover, such standards only specify the content of the file (export encoding); they do not impose standards on how to read (import interpretation) the file.
I suggest that you open the CSV file using Notepad to how your data is actually written to the file.
For your example, you should see literally "123 E Main St., Apt. 100B" with the double-quotes.
If you do not, the most likely explanation is that your R&LO settings specify a different list separator than comma. Excel double-quotes strings only as-needed to avoid confusion with the list separator.