-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Should Date parsing parse integer as year by default? #1681
Comments
A couple thoughts:
|
Vega-Lite doesn't have access to the data, so it only knows that the data is temporal, but doesn't know how the data looks like at all.
Yep
Given that we at least parse |
Technically this would require a breaking change, so we should probably shelve it for the time being. That said, in the future we could consider updating the date parsing as you suggest here and require a parsing specifier of In any case, I just tested and |
Should we re-open and put it in 6.0 milestone then? |
I do really like the suggestion of parsing four digit integers and strings as years by default when setting the data format to "temporal". As already mentioned above, I think this is a more common date storage format than integers as timestamps. It would be convenient to be able to simply specify that the data type is temporal in VL and have integers rendered as year. Doing that currently yields some odd results and one must recast the column as a string to get the desired behavior: Would you consider re-opening this and implementing this feature in Vega? We could change this on the Altair side of things and recast ints as str automatically when the temporal data type is used, but would like to avoid being inconsistent with VL here is possible. We're also discussing this in a few other places: |
reopened and moved into 6.0 |
Noting that Date parsing is handled not just by This is analogous to the thin wrapper around the Whatever solution is chosen, I think we would want to have My inclination is to ask if we want to keep the Date constructor matching the signature of the JS Date API (which seems to be a guideline when naming and implementing other vega expressions).
My 2c on whether year or timestamp formatting is common: timestamp formatting would be common for machine generated data (querying an API), but I see the popularity of Year format for data coming from human-authored spreadsheets. Is there some way we could make this step suggested by @kanitw more discoverable at the Altair or VL level so we can preserve the old behavior, while still giving good ergonomics to people who want to provide years as input?
|
Date parsing currently use integer as timestamp for parsing by default.
However, a common problem is that people actually store year as integer way more often than timestamps. While users can adjust the parse to
"%Y"
, most people don't know they have to do so.Thus, I wonder if we should adjust the default (or be smarter about date type inference in Vega).
cc: @jakevdp
The text was updated successfully, but these errors were encountered: