Phrazor SDK
Get API KeyPhrazor API
  • 👋Welcome
  • Docs
    • ⚡Quick Start
    • 🔑Get your API Key
    • Documentation
      • 📥Download and Import
      • 🔗Connect your Data
      • 🛠️Setup your Analysis
        • Descriptor
        • Change
        • Trend
        • Compare
        • Target vs Achievement
        • Budget vs Expense
        • Others
          • Filter your Data
      • 📋Generate your Insights
      • 📝Generate your Summary
      • 🔌Integrations
      • 💣Rate Limits
Powered by GitBook
On this page
  • Set Column Meta
  • Set Analysis Period
  • Set Metric Aggregation
  • Choose your Analysis
  • 1. Descriptor
  • 2. Change
  • 3. Trend
  • 4. Compare
  • 5. Target vs Achievement
  • 6. Budget vs Expense
  1. Docs
  2. Documentation

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

Parameter
Type
Description

date_column

str/dict

metric_column

str or List[str/dict]

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:

  1. "Date" is the date column with a string data type.

  2. "Sales" and "Quantity" are metric columns with integer data types.

  3. "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.

Key
Description

name

Name of the Date Column

period

Granular level at which you want to analyse your data. Accepted Values - "day", "week", "month", "quarter", "year"

If a date column is provided as a string, the assumption is that the period is set to month by default.

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.

Key
Description

name

Name of the Date Column

aggregation

Aggregation to apply on metric Accepted Values - "sum", "avg", "min", "max", "count"

If a metric is provided without an explicit aggregation key, the default behavior is to apply the sum aggregation method.

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

2. Change

Helps you to analyse growth or decline in metric over time

3. Trend

Alerts you to significant changes in trends, any early warning signs, spike

4. Compare

Compare values for specific metrics and dimensions. You can choose to either compare dimension or compare metrics.

5. Target vs Achievement

Assesses performance based on targets and achievements.

6. Budget vs Expense

Analyzes expense budgets and spends.

PreviousConnect your DataNextDescriptor

Last updated 1 year ago

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 . Default: None

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 . Default: None

To define period for your analysis, you will have to pass dictionary as a value in the date_column parameter of method with the following keys:

To define aggregation for your metric you will have to pass list of dictionaries as value in the metric_column parameter of method with the following keys:

🛠️
Descriptor
Change
Trend
Compare
Target vs Achievement
Budget vs Expense
set_column_meta
set_column_meta
here
here