Script 209: Yesterdays Cost Dimension Tagging Biotrue

Purpose

The script transfers yesterday’s cost data from a report to a bulk data format for further processing.

To Elaborate

The Python script is designed to facilitate the transfer of cost data from a report format to a bulk data format. Specifically, it copies the ‘Pub. Cost $’ from the input data frame and assigns it to the ‘Yesterdays Cost’ column in the output data frame. This operation is likely part of a larger process where cost data needs to be consistently formatted or tagged for further analysis or reporting purposes. The script ensures that the cost data from the previous day is accurately reflected in the bulk data format, which may be used for tasks such as budget allocation, financial analysis, or performance tracking.

Walking Through the Code

  1. Data Preparation
    • The script begins by creating a copy of the input data frame (inputDf) and assigns it to outputDf. This ensures that the original data remains unchanged while modifications are made to the copy.
  2. Data Transformation
    • The script then updates the outputDf by setting the ‘Yesterdays Cost’ column to the values from the ‘Pub. Cost $’ column. This step effectively transfers the cost data from the report format to the bulk format.
  3. Output
    • Finally, the script prints the transformed data frame using the tableize function, which likely formats the data for easy viewing or further processing.

Vitals

  • Script ID : 209
  • Client ID / Customer ID: 85764212 / 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:16
  • 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

comments powered by Disqus