In a CSV file, does spacing matter before and after commas?



In a CSV file, does spacing matter, such as before or after commas?


Yes, in most cases for CSV files, Pandas will separate the data by the commas, and will keep any spaces that were included before or after a comma.

Because of this, it is important that when creating a CSV file, each value should only be separated by a comma without any unwanted whitespace before or after the commas, since they will not be removed automatically.

Example CSV row

name, date, location

For the above example, when reading the data from this CSV, it will include the leading spaces for ’ date’ and ’ location’.