π οΈSetup your Analysis
Covers how to configure and prepare data for analysis.
Set Column Meta
The "Set Column Meta" method allows you to define metadata for the columns that are present in your dataset. By setting column metadata, you ensure that the library correctly interprets and processes your data during analysis.
Method Signature:
set_column_meta(
date_column: Union[dict, str] = None,
metric_column: Union[list, dict, str] = None,
dimension_column: Union[list, str] = None
) -> None
date_column
str/dict
Specify name of the column in your dataset that contains date related information.
Essential for accurate analysis and enabling the library to recognize and treat date values appropriately.
For more details refer here.
Default: None
metric_column
str or List[str/dict]
Specify the name of the column/columns that holds numerical data. This parameter helps identify the metrics that will be used for analysis, facilitating data-driven insights.
You can pass a single column name using string and multiple columns using a list.
For more details refer here.
Default: None
dimension_column
List[str]
Specify the name of column/columns that contains categorical data. It defines the dimensions, categories, or groupings within your dataset.
You can pass a single column name using string and multiple columns using a list.
Default: None
# Example of setting column metadata
phrzr.set_column_meta(
date_column="Date",
metric_column=["Sales", "Quantity"],
dimension_column=["Region", "State"]
)
In the above example, we've configured the metadata for columns as follows:
"Date" is the date column with a string data type.
"Sales" and "Quantity" are metric columns with integer data types.
"Region" and "State" are the dimensions to be analysed.
Set Analysis Period
To enhance the flexibility of data analysis users can specify the period aggregation for a particular date column within their dataset. This empowers users to tailor the granularity of their data analysis according to their specific needs.
To define period for your analysis, you will have to pass dictionary as a value in the date_column
parameter of set_column_meta method with the following keys:
name
Name of the Date Column
period
Granular level at which you want to analyse your data.
Accepted Values - "day
", "week
", "month
", "quarter
", "year
"
Example
To analyse your data at Weekly level you can set your column meta as follow:
phrzr.set_column_meta(
date_column={"name": "Date", "period": "week"},
metric_column="Sales",
)
Set Metric Aggregation
Provides users with the capability to define and customize the aggregation method applied to a specific metric within their dataset. This functionality empowers users to choose how their data is summarized and analyzed, tailoring the analysis to meet their specific analytical requirements.
To define aggregation for your metric you will have to pass list of dictionaries as value in the metric_column
parameter of set_column_meta method with the following keys:
name
Name of the Date Column
aggregation
Aggregation to apply on metric
Accepted Values - "sum
", "avg
", "min
", "max
", "count
"
Example
You can analyse the Avg Weekly Sales using the following snippet:
phrzr.set_column_meta(
date_column={"name": "Date", "period": "week"},
metric_column=[{"name": "Sales", "aggregation": "avg"}]
)
You can also set individual aggregation for each metric.
phrzr.set_column_meta(
date_column={"name": "Date", "period": "week"},
metric_column=[
{"name": "Sales", "aggregation": "avg"},
{"name": "Profit", "aggregation": "sum"},
{"name": "Product", "aggregation": "count"}
]
)
Choose your Analysis
Following are the various types of analyses that can be used to generate insights/summaries for your data. These analyses help you gain deeper insights and make informed decisions. Here's an overview of the different types of analyses available:
1. Descriptor
Helps you to analyse metrics by dimension or time
Descriptor2. Change
Helps you to analyse growth or decline in metric over time
Change3. Trend
Alerts you to significant changes in trends, any early warning signs, spike
Trend4. Compare
Compare values for specific metrics and dimensions. You can choose to either compare dimension or compare metrics.
Compare5. Target vs Achievement
Assesses performance based on targets and achievements.
Target vs Achievement6. Budget vs Expense
Analyzes expense budgets and spends.
Budget vs ExpenseLast updated