Script 1065: Script Campaign CPA This Quarter Set
Purpose
Set the value of the ‘Campaign CPA This Quarter’ column to the CPA for this quarter.
To Elaborate
The Python script takes the CPA (Cost Per Acquisition) for this quarter and sets the value in the ‘Campaign CPA This Quarter’ column. It copies the input data to the output and then copies the values from the ‘All - Complete Registration - CPA’ column to the ‘Campaign CPA This Quarter’ column.
Walking Through the Code
- The script starts by defining the primary data source and columns.
- It also defines the output columns and their initial values.
- The input data is copied to the output DataFrame.
- The values from the ‘All - Complete Registration - CPA’ column are copied to the ‘Campaign CPA This Quarter’ column in the output DataFrame.
- The tableized version of the output DataFrame is printed.
Vitals
- Script ID : 1065
- Client ID / Customer ID: 1306927809 / 60270355
- Action Type: Bulk Upload (Preview)
- Item Changed: Campaign
- Output Columns: Account, Campaign, Campaign CPA This Quarter
- Linked Datasource: M1 Report
- Reference Datasource: None
- Owner: Grégory Pantaine (gpantaine@marinsoftware.com)
- Created by Grégory Pantaine on 2024-05-10 15:36
- Last Updated by Grégory Pantaine on 2024-05-10 15:38
> See it in Action
Python Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## name: Script - Campaign - CPA This Quarter - Set
##
## description: Take CPA for this Quarter and set the value in the 'Campaign CPA This Quarter' column.
## Copied & adjusted by Grég P.
## created: 2024-05-10
# Primary data source and columns
inputDf = dataSourceDict["1"]
# Output columns and initial values
RPT_COL_CAMPAIGN = 'Campaign'
RPT_COL_ACCOUNT = 'Account'
RPT_COL_COMPLETE_REGISTRATION_CPA = 'All - Complete Registration - CPA'
RPT_COL_CAMPAIGN_CPA_QUARTER = 'Campaign CPA This Quarter'
BULK_COL_ACCOUNT = 'Account'
BULK_COL_CAMPAIGN = 'Campaign'
BULK_COL_CAMPAIGN_CPA_QUARTER = 'Campaign CPA This Quarter'
# Copy input data to output
outputDf = inputDf.copy()
# Copy values from 'Strategy' column to 'SBA Strategy' column
outputDf[RPT_COL_CAMPAIGN_CPA_QUARTER] = inputDf[RPT_COL_COMPLETE_REGISTRATION_CPA]
# Print the tableized version of the output DataFrame
print(tableize(outputDf))
Post generated on 2024-05-15 07:44:05 GMT