Skip to content
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

feat: Support datetime.(date|datetime) in Expression(s) #3654

Merged
merged 8 commits into from
Oct 30, 2024

Conversation

dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Oct 22, 2024

Closes #3652

Example

import datetime as dt

import altair as alt
from vega_datasets import data

base = (
    alt.Chart(data.stocks.url)
    .mark_line()
    .encode(x="date:T", y="price:Q", color="symbol:N")
)

predicate = alt.datum["date"] <= dt.date(2005, 1, 1)

chart = (
    base.transform_filter(predicate) | base.transform_filter(~predicate)
).resolve_scale(y="shared")
chart

image

@dangotbanned dangotbanned marked this pull request as ready for review October 30, 2024 09:31
Copy link
Contributor

@jonmmease jonmmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @dangotbanned, I really like the emphasis on improving the expression language API

@dangotbanned
Copy link
Member Author

This looks great @dangotbanned, I really like the emphasis on improving the expression language API

Thanks @jonmmease, appreciate the review

@dangotbanned dangotbanned merged commit 64c1e09 into main Oct 30, 2024
21 checks passed
@dangotbanned dangotbanned deleted the support-datetime-expr branch October 30, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support datetime.(date|datetime) in Expression(s)
2 participants