Script 207: Yesterdays Cost Dimension Tagging Ocuvite
Purpose
The script transfers yesterday’s cost data from a report column to a bulk column for further processing.
To Elaborate
The Python script is designed to manage and organize financial data related to advertising campaigns. Specifically, it focuses on transferring the cost data from a report column labeled “Pub. Cost $” to another column labeled “Yesterdays Cost” within a DataFrame. This operation is crucial for maintaining accurate records of daily expenditures, which can then be used for further analysis or reporting. The script ensures that the cost data is correctly aligned with the corresponding campaign and account information, facilitating structured budget allocation (SBA) and financial tracking.
Walking Through the Code
- Data Preparation
- The script begins by creating a copy of the input DataFrame,
inputDf
, tooutputDf
. This ensures that the original data remains unchanged while modifications are made to the copy.
- The script begins by creating a copy of the input DataFrame,
- Data Transfer
- The script transfers the values from the “Pub. Cost $” column in the
outputDf
to the “Yesterdays Cost” column. This step is essential for updating the cost data to reflect the previous day’s expenses accurately.
- The script transfers the values from the “Pub. Cost $” column in the
- Output Display
- Finally, the script uses a function
tableize
to print the modified DataFrame,outputDf
, which now contains the updated cost information. This allows users to visually verify the changes made to the data.
- Finally, the script uses a function
Vitals
- Script ID : 207
- Client ID / Customer ID: 94357244 / 45606
- Action Type: Bulk Upload
- Item Changed: Campaign
- Output Columns: Account, Campaign, Yesterdays Cost
- Linked Datasource: M1 Report
- Reference Datasource: None
- Owner: Autumn Archibald (aarchibald@marinsoftware.com)
- Created by Autumn Archibald on 2023-06-16 16:13
- Last Updated by Autumn Archibald on 2023-12-06 04:01
> See it in Action
Python Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
RPT_COL_CAMPAIGN = 'Campaign'
RPT_COL_ACCOUNT = 'Account'
RPT_COL_PUB_COST = 'Pub. Cost $'
RPT_COL_YESTERDAYS_COST = 'Yesterdays Cost'
BULK_COL_ACCOUNT = 'Account'
BULK_COL_CAMPAIGN = 'Campaign'
BULK_COL_YESTERDAYS_COST = 'Yesterdays Cost'
outputDf = inputDf.copy()
outputDf[BULK_COL_YESTERDAYS_COST] = outputDf[RPT_COL_PUB_COST]
print(tableize(outputDf))
Post generated on 2024-11-27 06:58:46 GMT