# How to import a column with the quantity days with SemanticImport

Posted 4 months ago
586 Views
|
2 Replies
|
0 Total Likes
|
 I want to import a column from a CSV file that is the type quantity. Is there a way to specify the type of quantity, for example, days?I've used the option "DateTime" and "Quantity," and I used free-form import for days, but that didn't work.I read the details of the documentation for semantic import.How do I tell it to assume the units are in days?
2 Replies
Sort By:
Posted 3 months ago
 That's basically what I did. I could do something like data//=Map[Quantity[#,"Days"]&] This is what I did: file = File[ "C:\\Users\\Peter\\OneDrive - Marshall \ University\\Documents\\sql.csv"] semanticData = SemanticImport[ file, {"DateTime", "DateTime", "DateTime", "Integer", "Integer", "Currency", "Integer", "String", "String"}, HeaderLines -> 1] semanticData //= MapAt[Quantity[#, "Days"] &, {All, "rental_duration"}] 
Posted 3 months ago
 I suspect (but am not positive) that this won't work the way you describe with SemanticImport. I think you might have better luck applying a function to the data after the import. Since you haven't provided any sample data to test with, I don't know exactly what to suggest, but it might be along the lines of Quantity[#, "Days"] &/@yourdata