Set difference
Set difference is the set of elements that belong to one set but not to another.
Build Python Web Apps with Streamlit
A delta is the difference between a metric's value in a main period and its value in a comparison period.
- How it is used
- Compares dashboard metrics across main and comparison date ranges to show change alongside the current value.
- How deep it goes
- Explains separate filtering, percentage calculation, formatting, and display, while stopping short of broader statistical interpretation.
- Examples
- Uses August and July sales, filtered dataframes, percentage formatting, and a metric bar as concrete examples.
- What you can do after
- Build it from scratch by calculating and formatting percentage deltas for Streamlit metric bars.
Read how Build Python Web Apps with Streamlit explains set difference →
Secrets of the JavaScript Ninja, Second Edition
The set of elements in one set that are not in another set.
- How it is used
- Filters a collection to retain elements absent from another set.
- How deep it goes
- Defines the operation and demonstrates it with JavaScript, without developing a formal treatment.
- Examples
- Demonstrates filtering ninjas to exclude those who are also samurai.
- What you can do after
- Apply set difference with JavaScript Set, spread, filter, and has.
Read how Secrets of the JavaScript Ninja, Second Edition explains set difference →
Also covered in
- The Well-Grounded Data Analyst
- Data Storytelling with Altair and AI
- The Well-Grounded Rubyist, Fourth Edition
- Clojure: The Essential Reference
- Julia as a Second Language
- Python How-To
- Secrets of the JavaScript Ninja, Third EditionIn early access (MEAP)
- Grokking Algorithms, Second Edition
What to know first
- for...ofThe JavaScript for...of statement iterates over successive values produced by an iterable's iterator.
- data frameA data frame is a two-dimensional tabular data structure organized into labeled rows and columns, often with columns that can contain different types of values.
- setA set is a collection of distinct elements in which membership, rather than order or duplicate occurrences, defines the collection.
- spread operatorA spread operator is syntax that unpacks a collection’s elements or an object’s properties into individual values within an expression or function call.
Related concepts
- setuses · A set is a collection of distinct elements in which membership, rather than order or duplicate occurrences, defines the collection.
- set intersectioncontrasts with · Set intersection is the set of elements that belong to every one of two or more sets.
- set operationkind of · A set operation combines, compares, or transforms sets according to the membership of their elements.
- setdiffimplemented by · setdiff is a Julia function that returns the elements present in one collection but absent from one or more other collections.
- st.metricused by · st.metric is a Streamlit display function that presents a labeled metric value and optionally its change from a reference value.
- disjalternative to · disj is a Clojure function that returns a set with one or more specified elements removed.
Questions about set difference
What is set difference?
Set difference is the set of elements that belong to one set but not to another.
Which Manning books explain set difference?
Build Python Web Apps with Streamlit and Secrets of the JavaScript Ninja, Second Edition.
What should I know before learning set difference?
Manning books that teach set difference usually introduce for...of, data frame, set and spread operator first.
What is the difference between set difference and set intersection?
Set difference is the set of elements that belong to one set but not to another. Set intersection is the set of elements that belong to every one of two or more sets.
What is set difference a kind of?
Set difference is a kind of set operation. A set operation combines, compares, or transforms sets according to the membership of their elements.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

