Adding Metadata / Identifier Data to a Csv File?

Is there a way to add a "tag" (add a unique metadata/identifier) to a CSV file without affecting the contents or ability to read/write the file?

I am using Python, but I don't think the language matters here.

2

3 Answers

This would be compliant with W3C embedded metadata format:

#publisher,W3C
#updated,2015-10-17T00:00:00Z
#name,sensor,temperature
#datatype,string,float
sensor,temperature
s-1,25.5

Just add comment lines that you can parse later.

#Creator:JohnSmith
#Date:....
#Columns:id,username,...
1,JohnSmith
2, ..
2

In case you are not sure that all possible readers/writers of the file will be able to interpret (and preserve) comments, create the tag in a second file using some name convention that links them. Example:

myCSVFile.csv
myCSVFile.csv.tag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest