Skip to content

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

Merged
dangotbanned merged 8 commits intomainfrom
support-datetime-expr
Oct 30, 2024
Merged

feat: Support datetime.(date|datetime) in Expression(s)#3654
dangotbanned merged 8 commits intomainfrom
support-datetime-expr

Conversation

@dangotbanned
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

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

Thanks @jonmmease, appreciate the review

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