filters
This commit is contained in:
@@ -103,9 +103,38 @@ def _(mo):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@app.cell(hide_code=True)
|
||||||
|
def _(data_all, mo):
|
||||||
|
data_all_collected = data_all.collect()
|
||||||
|
ages = mo.ui.multiselect(options=data_all_collected["QID1"], value=data_all_collected["QID1"].unique(), label="Select Age Group(s):")
|
||||||
|
income = mo.ui.multiselect(data_all_collected["QID15"], value=data_all_collected["QID15"], label="Select Income Group(s):")
|
||||||
|
gender = mo.ui.multiselect(data_all_collected["QID2"], value=data_all_collected["QID2"], label="Select Gender(s)")
|
||||||
|
ethnicity = mo.ui.multiselect(data_all_collected["QID3"], value=data_all_collected["QID3"], label="Select Ethnicities:")
|
||||||
|
consumer = mo.ui.multiselect(data_all_collected["Consumer"], value=data_all_collected["Consumer"], label="Select Consumer Groups:")
|
||||||
|
|
||||||
|
|
||||||
|
mo.md(f"""
|
||||||
|
# Data Filters
|
||||||
|
|
||||||
|
|
||||||
|
{ages}
|
||||||
|
|
||||||
|
{gender}
|
||||||
|
|
||||||
|
{ethnicity}
|
||||||
|
|
||||||
|
{income}
|
||||||
|
|
||||||
|
{consumer}
|
||||||
|
|
||||||
|
""")
|
||||||
|
return ages, consumer, ethnicity, gender, income
|
||||||
|
|
||||||
|
|
||||||
@app.cell
|
@app.cell
|
||||||
def _(data_all, survey):
|
def _(ages, consumer, data_all, ethnicity, gender, income, survey):
|
||||||
data = survey.filter_data(data_all, age=None, gender=None, income=None, ethnicity=None, consumer=None)
|
data = survey.filter_data(data_all, age=ages.value, gender=gender.value, income=income.value, ethnicity=ethnicity.value, consumer=consumer.value)
|
||||||
|
data.collect()
|
||||||
return (data,)
|
return (data,)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user