Adding metadata / identifier data to a CSV file?

Is there a way to add a “tag” (add unique metadata / identifier) ​​to a CSV file without affecting the content or the ability to read / write the file?

I use Python, but I do not think this language matters here.

+6
source share
3 answers

Just add comment lines that you can analyze later.

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

This will follow the W3C embedded metadata format: http://www.w3.org/TR/tabular-data-model/#embedded-metadata

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

If you are not sure that all possible readers / writers of the file will be able to interpret (and save) the comments, create a tag in the second file using some kind of naming convention that connects them. Example:

 myCSVFile.csv myCSVFile.csv.tag 
+3
source

Source: https://habr.com/ru/post/952222/


All Articles