-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when informing data types, use functions to parse type (e.g. DateTime) #899
Comments
Does passing my_data = CSV.read(file, DataFrame, header = 1, copycols = true, types = Dict(:time => Dates.DateTime), dateformat = "YYYY-MM-DD HH:MM:SS") |
Nope. It returns me this error for every row in my dataset.
And the dataframe
|
i wonder if that's just because the |
wow, it worked just fine. But I remain with question. Wouldn't it be a nice feature to let the function operate in the dictionary? |
It would be really hard, nay impossible, to support arbitrary transform functions efficiently like this. For instance, in your first example, calling The other difficulty in allowing arbitrary functions would be the column typing; you can't really know the result type of applying a function like this, so it would be hard to have the column value setting be an efficient operation, which would really bloat parsing times. As I've considered this in the past, there's really no advantage to having something like that builtin to CSV.read vs. just doing the transformation yourself post-parsing on the |
Lets say I have a dataset with a DateTime type in one of its columns. Some SQL requests return datetime types as
YYYY-MM-DD HH:MM:SS
e.g.2019-03-01 14:04:31
. When reading with CSV.read I'm not able to usebecause Dates.DateTime doesn't accept
YYYY-MM-DD HH:MM:SS
onlyYYYY-MM-DDTHH:MM:SS
. One should be able to inform what is the DateTime structure before reading it with Dates.DateTime function, which allows us to inform what is the structure of the DateTime. e.g.The text was updated successfully, but these errors were encountered: