How to filter data based on date?
See original GitHub issueThis doesn’t seem to work:
from altair import *
Chart(Data(
formatType='csv',
url='http://vega.github.io/vega-lite/data/stocks.csv',
),
description='Stock prices of 5 Tech Companies Over Time.',
).mark_line().encode(
color='symbol:N',
x='date:T',
y='price:Q',
).transform_data(filter='datum.date < "2008-01-01"')
By the way the example on this page https://altair-viz.github.io/gallery/line_color.html is broken since ‘format’ is no longer a valid argument to ‘Data’
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Filter by date - Excel formula - Exceljet
To filter data to include data based on dates, you can use the FILTER function with one of Excel's date functions. In the...
Read more >How to Filter Date Range in Excel (5 Easy Methods)
Select any cells among B4 and D4 and then go to Home >> Sort & Filter >> Filter · After that, click on...
Read more >How to Filter Data Based on Dates - MicroStrategy
Click Create on any page, and select New Filter. · In the pane on the left, navigate to the attribute with the date...
Read more >Filter by date | Algolia
Dates aren't only useful for sorting. You can also leverage them to filter search results on a specific date range. Imagine you have...
Read more >Excel Filter for Date Range 2 Ways - Contextures Blog
The first way to filter for a date range, is to use one of the Date Filter options. There are dynamic date range...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As you’ve written it, none of the rows pass the filter because none of the timestamps are equal to the string
'2000'
. If you want to extract the year from a timestamp in a vega-lite filter expression, you can use vega expressions to do so. For example:thanks!! Vega expressions look very useful.