A set is an unordered collection of distinct elements used for membership testing and set operations. In data analysis, it provides a compact way to compare categorical values, column names, or reference lists. section 6.4.1 section 2.2.2
Sets are useful when exploring imperfect datasets: compare available survey columns with a data dictionary, or find reference cities that never appear in customer data. The result supports investigation rather than replacing judgment about missing or unmatched records. section 6.4.1 section 2.2.2
Compare two collections
Use intersection to find shared values: len(set(survey.columns).intersection(set(data_dict["qname"]))). Use difference to find reference cities absent from customer records: set(cities["city"]) - set(customers["city"]). section 6.4.1 section 2.2.2
len(set(survey.columns).intersection(set(data_dict["qname"])))
Inspect a working set intersection that counts survey columns represented in the data dictionary. section 6.4.1














