Filter your Data
Filter your data and analyse
Set Filter Meta
set_filter_meta
method offers a suite of filtering options that allow users to extract specific subsets of data based on their criteria, facilitating in-depth exploration and targeted analysis. It provides a range of filtering options, such as equality, inequality, inclusion, exclusion, and date-based filters. Users can combine these options to create complex filter conditions.
Dimension Filters
in
List[str] or str
checks if a text value is present in a specified list of text values.
not in
List[str] or str
checks if a text value is not present in a specified list of text values.
Example
First snippet selects data values containing Asia and Australia and Oceania Region while the second one selects all other Regions except Asia.
# Multiple values can be passed as list
phrzr.set_filter_meta([
{
"operator": "in",
"column_name": "Region",
"data_type": "text",
"values": ["Asia", "Australia and Oceania"]
}
])
# Single value can be passed as string
phrzr.set_filter_meta([
{
"operator": "not in",
"column_name": "Region",
"data_type": "text",
"values": "Asia"
}
])
Metric Filters
equals
List[int, float] or int or float
checks if a value is equal to the specified reference value
not equals
List[int, float] or int or float
checks if a value is not equal to the specified reference value.
greater than
List[int, float] or int or float
checks if a value is greater than the specified reference value.
greater than equals
List[int, float] or int or float
checks if a value is greater than or equal to the specified reference value.
less than
List[int, float] or int or float
checks if a value is less than the specified reference value.
less than equals
List[int, float] or int or float
checks if a value is less than or equal to the specified reference value.
in range
List[int, float]
checks if a value falls within the specified range defined by a list of two numeric values.
not in range
List[int, float]
checks if a value falls outside the specified range defined by a list of two numeric values.
Example
First snippet filter rows where the "Total Cost" column is in the range [10, 50] exclusive of given values while other snippets checks equals and not equals for the given values.
# 2 values are required for range filters operator
phrzr.set_filter_meta([
{
"operator": "in range",
"column_name": "Total Cost",
"data_type": "numeric",
"values": [10, 50]
}
])
# Single value can be passed as int or float
phrzr.set_filter_meta([
{
"operator": "equals",
"column_name": "Total Cost",
"data_type": "numeric",
"values": 10
}
])
# Multiple value can be passed as List[int, float]
phrzr.set_filter_meta([
{
"operator": "not equals",
"column_name": "Total Cost",
"data_type": "numeric",
"values": [10, 50, 200]
}
])
Date Filters
in
List[int, str] or str or int
checks if a text value is present in a specified list of text values.
not in
List[int, str] or str or int
checks if a text value is not present in a specified list of text values.
in range
List[int, str] or str or int
checks if a value falls within the specified range defined by a list of two date values.
Year
List[int] or int
2023, 2024
Quarter
List[str] or str
"Quarter 1-2023", "Quarter 2-2023"
Month
List[str] or str
"March-2023", "April-2023"
Week
List[str] or str
"Wk1-2023", "Wk53-2023"
Day
List[str] or str
"1st March-2023", "2nd February-2023"
Example
phrzr.set_filter_meta([
{
"operator": "in",
"column_name": "Order Date",
"data_type": "timestamp",
"period": "Year",
"values": [2023]
}
])
phrzr.set_filter_meta([
{
"operator": "in",
"column_name": "Order Date",
"data_type": "timestamp",
"period": "Quarter",
"values": ["Quarter 2-2023"]
}
])
# 2 values can be given for in range filter
phrzr.set_filter_meta([
{
"operator": "in range",
"column_name": "Order Date",
"data_type": "timestamp",
"period": "Month",
"values": ["January-2023", "April-2023"]
}
])
phrzr.set_filter_meta([
{
"operator": "in",
"column_name": "Order Date",
"data_type": "timestamp",
"period": "Week", "values": "Wk4-2020"
}
])
phrzr.set_filter_meta([
{
"operator": "in",
"column_name": "Order Date",
"data_type": "timestamp",
"period": "Day",
"values": ["1st January-2023"]
}
])
Reset Filters
reset_filters
method can be used if you want to reset previously applied filters before getting further insights.
phrzr.reset_filters()
Last updated