Is it possible to transform_filter with a test against a list?
See original GitHub issueHere’s what I mean.
import altair as alt
from vega_datasets import data
df = data.stocks()
alt.Chart(df).mark_line().encode(
x='date:T',
y='price:Q',
color="symbol",
column="symbol:N"
).transform_filter(alt.datum.symbol in ["AAPL", "AMZN"])
I’m trying to spit out a restricted list of two charts, for Apple and Amazon. But this raises an error.
SchemaValidationError: Invalid specification
altair.vegalite.v2.schema.core.FilterTransform ->filter, validating 'anyOf'
True is not valid under any of the given schemas
This is a use case I see as pretty common. For instance, after grouping on a field I’d like to spit out mini multiple charts of the top ten ranking values.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Creating a Drop Down Filter to Extract Data Based on Selection
Here are the steps to create a drop-down filter that will extract data for the selected item: Create a Unique list of items....
Read more >Quick start: Filter data by using an AutoFilter - Microsoft Support
Use the AutoFilter to filter a range of data in Excel 2010 and learn how to ... Selecting values from a list and...
Read more >Using the Excel FILTER Function to Create Dynamic Filters
Learn how to use the new FILTER function in Excel to create dynamic filters. These dynamic filters will update filter results immediately ...
Read more >Excel FILTER function with formula examples - Ablebits
See how to filter in Excel dynamically with formulas. Examples to filter duplicates, cells containing certain text, with multiple criteria, ...
Read more >How to Use Slicers With Excel Advanced Filter - Contextures
Use Excel Slicers to select criteria, show matching records from list. View specific data, keep original records safe on hidden worksheet.
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
Oh, I should have also mentioned that a wrapper for this exists in Altair:
It would not be possible to make this work using something like
alt.datum.symbol in ["AAPL", "AMZN"]
, because in Pythonx in y
always returns a boolean, and the language provides no mechanism to overload the behavior of thein
operator.