Script 1435: AP 77671 revenue backfill

Purpose:

The Python script processes and transforms revenue data from various app store and subscription services to create a structured output for analysis.

To Elaborate

The script is designed to process revenue data from multiple sources, specifically focusing on app store downloads, in-app purchases, subscriptions, and other digital content transactions. It takes input data, identifies specific product types, and maps them to corresponding revenue and conversion metrics. The script handles various product categories such as iOS and Mac downloads, music subscriptions, and video rentals, among others. It also processes different subscription tiers and promotional offers, ensuring that the data is accurately categorized and structured for further analysis. The script is particularly useful for businesses that need to analyze revenue streams from digital content and subscriptions, providing a comprehensive view of financial performance across different platforms and product types.

Walking Through the Code

  1. Initialization and Setup
    • The script begins by defining constants for devices and match types, which are used to categorize data.
    • It sets up the primary data source and specifies the columns to be used for input and output data frames.
  2. Data Processing Function
    • The try_process_row function attempts to process each row of the input data, handling exceptions gracefully.
    • The process_row function is the core of the script, where each row is analyzed and transformed based on specific business rules.
  3. Row Processing Logic
    • The script checks for specific product identifiers in the input data to determine the type of transaction (e.g., iOS downloads, subscriptions).
    • It modifies the output data by setting appropriate values for keyword IDs, creative IDs, and other relevant fields based on the input data.
  4. Revenue and Conversion Mapping
    • For each identified product type, the script maps conversion and revenue data from the input to the output data frame.
    • It handles different scenarios, such as free versus paid transactions, and updates the output data accordingly.
  5. Final Data Frame Construction
    • After processing all rows, the script constructs the final output data frame, ensuring it includes all necessary columns for analysis.
    • The output data frame is structured to facilitate easy analysis of revenue and conversion metrics across different product categories and platforms.

Vitals

  • Script ID : 1435
  • Client ID / Customer ID: 250196703 / 67956
  • Action Type: Revenue Upload (Preview)
  • Item Changed: None
  • Output Columns: Date, Device
  • Linked Datasource: FTP/Email Feed
  • Reference Datasource: None
  • Owner: None (tzhang@marinsoftware.com)
  • Created by tzhang@marinsoftware.com on 2024-10-11 03:00
  • Last Updated by Mingxia Wu on 2025-02-10 13:42
> 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
##
## name: AP-77671-revenue-backfill
## description:
##  
## 
## author: Mingxia Wu
## created: 2024-10-11
## updated:2025-01-26
## 

DEVICE = {
  'MOBILE': 'm',
  'DESKTOP': 'c',
  'TABLET': 't',
}
MATCH_TYPE = {
  'EXACT': 'exact',
  'PHRASE': 'phrase',
  'BROAD': 'broad',
}
today = datetime.datetime.now(CLIENT_TIMEZONE).date()

# primary data source and columns
inputDf = dataSourceDict["1"]

# output columns and initial values
REVENUE_COL_DATE = 'Date'
REVENUE_COL_CURRENCY = 'Currency'
REVENUE_COL_DEVICE = 'Device'
REVENUE_COL_KEYWORD_ID = 'Keyword ID'
REVENUE_COL_CREATIVE_ID = 'Creative ID'
REVENUE_COL_KEYWORD = 'Keyword'
REVENUE_COL_MATCH_TYPE = 'Match Type'
REVENUE_COL_GROUP_ID = 'Group ID'
REVENUE_COL_PRODUCT_ID = 'Product ID'
REVENUE_COL_SL_ID = 'SL ID'
REVENUE_COL_ADEXTENSION_ID = 'AdExtension ID'
REVENUE_COL_TARGET_IDS = 'Target IDs'
REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_CONV = 'APP STORE - iOS Downloads (Click Date) Conv'
REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_REV = 'APP STORE - iOS Downloads (Click Date) Rev'
REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_CONV = 'APP STORE - iOS Downloads (Conv Date) Conv'
REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_REV = 'APP STORE - iOS Downloads (Conv Date) Rev'
REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_CONV = 'APP STORE - iOS InApp Purchases (Click Date) Conv'
REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_REV = 'APP STORE - iOS InApp Purchases (Click Date) Rev'
REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_CONV = 'APP STORE - iOS InApp Purchases (Conv Date) Conv'
REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_REV = 'APP STORE - iOS InApp Purchases (Conv Date) Rev'
REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_CONV = 'APP STORE - iOS Redownload (Click Date) Conv'
REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_REV = 'APP STORE - iOS Redownload (Click Date) Rev'
REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_CONV = 'APP STORE - iOS Redownload (Conv Date) Conv'
REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_REV = 'APP STORE - iOS Redownload (Conv Date) Rev'
REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_CONV = 'APP STORE - Mac Downloads (Click Date) Conv'
REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_REV = 'APP STORE - Mac Downloads (Click Date) Rev'
REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_CONV = 'APP STORE - Mac Downloads (Conv Date) Conv'
REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_REV = 'APP STORE - Mac Downloads (Conv Date) Rev'
REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_CONV = 'APP STORE - Mac Redownload (Click Date) Conv'
REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_REV = 'APP STORE - Mac Redownload (Click Date) Rev'
REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_CONV = 'APP STORE - Mac Redownload (Conv Date) Conv'
REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_REV = 'APP STORE - Mac Redownload (Conv Date) Rev'
# REVENUE_COL_APPLE_ICLOUD_PURCHASE_CLICK_DATE_CONV = 'Apple iCloud Purchase (Click Date) Conv'
# REVENUE_COL_APPLE_ICLOUD_PURCHASE_CLICK_DATE_REV = 'Apple iCloud Purchase (Click Date) Rev'
# REVENUE_COL_APPLE_ICLOUD_PURCHASE_CONV_DATE_CONV = 'Apple iCloud Purchase (Conv Date) Conv'
# REVENUE_COL_APPLE_ICLOUD_PURCHASE_CONV_DATE_REV = 'Apple iCloud Purchase (Conv Date) Rev'
# REVENUE_COL_APPLE_ICLOUD_REDEMPTION_CLICK_DATE_CONV = 'Apple iCloud Redemption (Click Date) Conv'
# REVENUE_COL_APPLE_ICLOUD_REDEMPTION_CLICK_DATE_REV = 'Apple iCloud Redemption (Click Date) Rev'
# REVENUE_COL_APPLE_ICLOUD_REDEMPTION_CONV_DATE_CONV = 'Apple iCloud Redemption (Conv Date) Conv'
# REVENUE_COL_APPLE_ICLOUD_REDEMPTION_CONV_DATE_REV = 'Apple iCloud Redemption (Conv Date) Rev'
REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_CONV = 'APPLE ONE - Combined (Click Date) Conv'
REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_REV = 'APPLE ONE - Combined (Click Date) Rev'
REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_CONV = 'APPLE ONE - Combined (Conv Date) Conv'
REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_REV = 'APPLE ONE - Combined (Conv Date) Rev'
REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_CONV = 'Apple One - Family (Click Date) Conv'
REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_REV = 'Apple One - Family (Click Date) Rev'
REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_CONV = 'Apple One - Family (Conv Date) Conv'
REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_REV = 'Apple One - Family (Conv Date) Rev'
REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_CONV = 'Apple One - Individual (Click Date) Conv'
REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_REV = 'Apple One - Individual (Click Date) Rev'
REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_CONV = 'Apple One - Individual (Conv Date) Conv'
REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_REV = 'Apple One - Individual (Conv Date) Rev'
REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_CONV = 'Apple One - Premier (Click Date) Conv'
REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_REV = 'Apple One - Premier (Click Date) Rev'
REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_CONV = 'Apple One - Premier (Conv Date) Conv'
REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_REV = 'Apple One - Premier (Conv Date) Rev'
REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_CONV = 'Apple One Subscription (Click Date) Conv'
REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_REV = 'Apple One Subscription (Click Date) Rev'
REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_CONV = 'Apple One Subscription (Conv Date) Conv'
REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_REV = 'Apple One Subscription (Conv Date) Rev'
REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_CONV = 'Apple Voice Subscription (Click Date) Conv'
REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_REV = 'Apple Voice Subscription (Click Date) Rev'
REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_CONV = 'Apple Voice Subscription (Conv Date) Conv'
REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_REV = 'Apple Voice Subscription (Conv Date) Rev'
REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_CONV = 'ARCADE - Subscriptions (Click Date) Conv'
REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_REV = 'ARCADE - Subscriptions (Click Date) Rev'
REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_CONV = 'ARCADE - Subscriptions (Conv Date) Conv'
REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_REV = 'ARCADE - Subscriptions (Conv Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_CONV = 'Audiobook Purchases (Click Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_REV = 'Audiobook Purchases (Click Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_CONV = 'Audiobook Purchases (Conv Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_REV = 'Audiobook Purchases (Conv Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_CONV = 'Audiobook Purchases - Free (Click Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_REV = 'Audiobook Purchases - Free (Click Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_CONV = 'Audiobook Purchases - Free (Conv Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_REV = 'Audiobook Purchases - Free (Conv Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_CONV = 'Audiobook Purchases - Paid (Click Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_REV = 'Audiobook Purchases - Paid (Click Date) Rev'
REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_CONV = 'Audiobook Purchases - Paid (Conv Date) Conv'
REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_REV = 'Audiobook Purchases - Paid (Conv Date) Rev'
REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_CONV = 'Book Purchases (Click Date) Conv'
REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_REV = 'Book Purchases (Click Date) Rev'
REVENUE_COL_BOOK_PURCHASES_CONV_DATE_CONV = 'Book Purchases (Conv Date) Conv'
REVENUE_COL_BOOK_PURCHASES_CONV_DATE_REV = 'Book Purchases (Conv Date) Rev'
REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_CONV = 'Book Purchases - Free (Click Date) Conv'
REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_REV = 'Book Purchases - Free (Click Date) Rev'
REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_CONV = 'Book Purchases - Free (Conv Date) Conv'
REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_REV = 'Book Purchases - Free (Conv Date) Rev'
REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_CONV = 'Book Purchases - Paid (Click Date) Conv'
REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_REV = 'Book Purchases - Paid (Click Date) Rev'
REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_CONV = 'Book Purchases - Paid (Conv Date) Conv'
REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_REV = 'Book Purchases - Paid (Conv Date) Rev'
REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_CONV = 'Music Redemption (Click Date) Conv'
REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_REV = 'Music Redemption (Click Date) Rev'
REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_CONV = 'Music Redemption (Conv Date) Conv'
REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_REV = 'Music Redemption (Conv Date) Rev'
REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_CONV = 'Music Subscription (Click Date) Conv'
REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_REV = 'Music Subscription (Click Date) Rev'
REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_CONV = 'Music Subscription (Conv Date) Conv'
REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_REV = 'Music Subscription (Conv Date) Rev'
REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_CONV = 'News Amplify Subscriptions (Click Date) Conv'
REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_REV = 'News Amplify Subscriptions (Click Date) Rev'
REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_CONV = 'News Amplify Subscriptions (Conv Date) Conv'
REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_REV = 'News Amplify Subscriptions (Conv Date) Rev'
REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_CONV = 'News Subscriptions (Click Date) Conv'
REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_REV = 'News Subscriptions (Click Date) Rev'
REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_CONV = 'News Subscriptions (Conv Date) Conv'
REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_REV = 'News Subscriptions (Conv Date) Rev'
REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_CONV = 'Promoted App Installs (Click Date) Conv'
REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_REV = 'Promoted App Installs (Click Date) Rev'
REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_CONV = 'Promoted App Installs (Conv Date) Conv'
REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_REV = 'Promoted App Installs (Conv Date) Rev'
REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_CONV = 'Singular - App Open (Click Date) Conv'
REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_REV = 'Singular - App Open (Click Date) Rev'
REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_CONV = 'Singular - App Open (Conv Date) Conv'
REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_REV = 'Singular - App Open (Conv Date) Rev'
REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_CONV = 'Singular subscription (Click Date) Conv'
REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_REV = 'Singular subscription (Click Date) Rev'
REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_CONV = 'Singular subscription (Conv Date) Conv'
REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_REV = 'Singular subscription (Conv Date) Rev'
REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_CONV = 'VIDEO - Acquisitions (Click Date) Conv'
REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_REV = 'VIDEO - Acquisitions (Click Date) Rev'
REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_CONV = 'VIDEO - Acquisitions (Conv Date) Conv'
REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_REV = 'VIDEO - Acquisitions (Conv Date) Rev'
REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_CONV = 'VIDEO - MLS Redemption (Click Date) Conv'
REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_REV = 'VIDEO - MLS Redemption (Click Date) Rev'
REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_CONV = 'VIDEO - MLS Redemption (Conv Date) Conv'
REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_REV = 'VIDEO - MLS Redemption (Conv Date) Rev'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_CONV = 'VIDEO - MLS Season Pass (Click Date) Conv'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_REV = 'VIDEO - MLS Season Pass (Click Date) Rev'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_CONV = 'VIDEO - MLS Season Pass (Conv Date) Conv'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_REV = 'VIDEO - MLS Season Pass (Conv Date) Rev'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_CONV = 'VIDEO - MLS Season Pass 1 Month (Click Date) Conv'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_REV = 'VIDEO - MLS Season Pass 1 Month (Click Date) Rev'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_CONV = 'VIDEO - MLS Season Pass 1 Month (Conv Date) Conv'
REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_REV = 'VIDEO - MLS Season Pass 1 Month (Conv Date) Rev'
REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_CONV = 'VIDEO - MLS Subscription (Click Date) Conv'
REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_REV = 'VIDEO - MLS Subscription (Click Date) Rev'
REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_CONV = 'VIDEO - MLS Subscription (Conv Date) Conv'
REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_REV = 'VIDEO - MLS Subscription (Conv Date) Rev'
REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_CONV = 'VIDEO - Movie Purchases (Click Date) Conv'
REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_REV = 'VIDEO - Movie Purchases (Click Date) Rev'
REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_CONV = 'VIDEO - Movie Purchases (Conv Date) Conv'
REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_REV = 'VIDEO - Movie Purchases (Conv Date) Rev'
REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_CONV = 'VIDEO - Transactions (Click Date) Conv'
REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_REV = 'VIDEO - Transactions (Click Date) Rev'
REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_CONV = 'VIDEO - Transactions (Conv Date) Conv'
REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_REV = 'VIDEO - Transactions (Conv Date) Rev'
REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_CONV = 'VIDEO - TV Show Purchases (Click Date) Conv'
REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_REV = 'VIDEO - TV Show Purchases (Click Date) Rev'
REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_CONV = 'VIDEO - TV Show Purchases (Conv Date) Conv'
REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_REV = 'VIDEO - TV Show Purchases (Conv Date) Rev'
REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_CONV = 'VIDEO - TV Subscriptions (Click Date) Conv'
REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_REV = 'VIDEO - TV Subscriptions (Click Date) Rev'
REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_CONV = 'VIDEO - TV Subscriptions (Conv Date) Conv'
REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_REV = 'VIDEO - TV Subscriptions (Conv Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_CONV = 'Video - TVPlus Amplify Subscription (Click Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_REV = 'Video - TVPlus Amplify Subscription (Click Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_CONV = 'Video - TVPlus Amplify Subscription (Conv Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_REV = 'Video - TVPlus Amplify Subscription (Conv Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_CONV = 'VIDEO - TVPlus Entitlements (Click Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_REV = 'VIDEO - TVPlus Entitlements (Click Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_CONV = 'VIDEO - TVPlus Entitlements (Conv Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_REV = 'VIDEO - TVPlus Entitlements (Conv Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_CONV = 'VIDEO - TVPlus Subscription (Click Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_REV = 'VIDEO - TVPlus Subscription (Click Date) Rev'
REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_CONV = 'VIDEO - TVPlus Subscription (Conv Date) Conv'
REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_REV = 'VIDEO - TVPlus Subscription (Conv Date) Rev'
REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_CONV = 'VIDEO - Video Rentals (Click Date) Conv'
REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_REV = 'VIDEO - Video Rentals (Click Date) Rev'
REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_CONV = 'VIDEO - Video Rentals (Conv Date) Conv'
REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_REV = 'VIDEO - Video Rentals (Conv Date) Rev'
REVENUE_COL_CONVERSIONS = 'Conversions'
REVENUE_COL_REVENUE = 'Revenue'
REVENUE_COL_TOTAL_CONVERSIONS = 'Tot. (Conv Date) Conv'
REVENUE_COL_TOTAL_REVENUE = 'Tot. (Conv Date) Rev'

outputDf = pd.DataFrame({
    REVENUE_COL_DATE: inputDf[REVENUE_COL_DATE],
    REVENUE_COL_CURRENCY: inputDf[REVENUE_COL_CURRENCY],
    REVENUE_COL_DEVICE: inputDf[REVENUE_COL_DEVICE],
    REVENUE_COL_KEYWORD_ID: inputDf[REVENUE_COL_KEYWORD_ID],
    REVENUE_COL_CREATIVE_ID: inputDf[REVENUE_COL_CREATIVE_ID],
    REVENUE_COL_KEYWORD: inputDf[REVENUE_COL_KEYWORD],
    REVENUE_COL_MATCH_TYPE: inputDf[REVENUE_COL_MATCH_TYPE],
    REVENUE_COL_GROUP_ID: inputDf[REVENUE_COL_GROUP_ID],
    REVENUE_COL_PRODUCT_ID: inputDf[REVENUE_COL_PRODUCT_ID],
    REVENUE_COL_CONVERSIONS: inputDf[REVENUE_COL_CONVERSIONS],
    REVENUE_COL_REVENUE: inputDf[REVENUE_COL_REVENUE],
    REVENUE_COL_TOTAL_CONVERSIONS: inputDf[REVENUE_COL_TOTAL_CONVERSIONS],
    REVENUE_COL_TOTAL_REVENUE: inputDf[REVENUE_COL_TOTAL_REVENUE],
    REVENUE_COL_SL_ID: inputDf[REVENUE_COL_SL_ID],
    REVENUE_COL_ADEXTENSION_ID: "",  # This column is filled with empty strings
    REVENUE_COL_TARGET_IDS: inputDf[REVENUE_COL_TARGET_IDS],
    REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_REV: inputDf[REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CLICK_DATE_REV],
    REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_REV: inputDf[REVENUE_COL_APP_STORE__IOS_DOWNLOADS_CONV_DATE_REV],
    REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_REV: inputDf[REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CLICK_DATE_REV],
    REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_REV:inputDf[REVENUE_COL_APP_STORE__IOS_INAPP_PURCHASES_CONV_DATE_REV],
    REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_CONV:  inputDf[REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_REV: inputDf[REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CLICK_DATE_REV],
    REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_CONV:inputDf[REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_CONV],
    REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_REV: inputDf[REVENUE_COL_APP_STORE__IOS_REDOWNLOAD_CONV_DATE_REV],
    REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_CONV],
    REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_REV: inputDf[REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CLICK_DATE_REV],
    REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_CONV],
    REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_REV: inputDf[REVENUE_COL_APP_STORE__MAC_DOWNLOADS_CONV_DATE_REV],
    REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_CONV],
    REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_REV: inputDf[REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CLICK_DATE_REV],
    REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_CONV: inputDf[REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_CONV],
    REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_REV: inputDf[REVENUE_COL_APP_STORE__MAC_REDOWNLOAD_CONV_DATE_REV],
    REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__COMBINED_CLICK_DATE_REV],
    REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_CONV],
    REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__COMBINED_CONV_DATE_REV],
    REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__FAMILY_CLICK_DATE_REV],
    REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_CONV],
    REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__FAMILY_CONV_DATE_REV],
    REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__INDIVIDUAL_CLICK_DATE_REV],
    REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_CONV],
    REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__INDIVIDUAL_CONV_DATE_REV],
    REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__PREMIER_CLICK_DATE_REV],
    REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_CONV],
    REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE__PREMIER_CONV_DATE_REV],
    REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_ONE_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_APPLE_VOICE_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_CONV],
    REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_ARCADE__SUBSCRIPTIONS_CLICK_DATE_REV],
    REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_CONV],
    REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_REV: inputDf[REVENUE_COL_ARCADE__SUBSCRIPTIONS_CONV_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES_CLICK_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES_CONV_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CLICK_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__FREE_CONV_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CLICK_DATE_REV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_CONV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_CONV],
    REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_REV: inputDf[REVENUE_COL_AUDIOBOOK_PURCHASES__PAID_CONV_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES_CLICK_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES_CONV_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES_CONV_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES_CONV_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES_CONV_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES__FREE_CLICK_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES__FREE_CONV_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES__PAID_CLICK_DATE_REV],
    REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_CONV: inputDf[REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_CONV],
    REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_REV: inputDf[REVENUE_COL_BOOK_PURCHASES__PAID_CONV_DATE_REV],
    REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_CONV],
    REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_MUSIC_REDEMPTION_CLICK_DATE_REV],
    REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_CONV],
    REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_REV: inputDf[REVENUE_COL_MUSIC_REDEMPTION_CONV_DATE_REV],
    REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_MUSIC_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_MUSIC_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_CONV],
    REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CLICK_DATE_REV],
    REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_CONV],
    REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_REV: inputDf[REVENUE_COL_NEWS_AMPLIFY_SUBSCRIPTIONS_CONV_DATE_REV],
    REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_CONV],
    REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_NEWS_SUBSCRIPTIONS_CLICK_DATE_REV],
    REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_CONV],
    REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_REV: inputDf[REVENUE_COL_NEWS_SUBSCRIPTIONS_CONV_DATE_REV],
    REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_CONV: inputDf[REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_CONV],
    REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_REV: inputDf[REVENUE_COL_PROMOTED_APP_INSTALLS_CLICK_DATE_REV],
    REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_CONV: inputDf[REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_CONV],
    REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_REV: inputDf[REVENUE_COL_PROMOTED_APP_INSTALLS_CONV_DATE_REV],
    REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_CONV: inputDf[REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_CONV],
    REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_REV: inputDf[REVENUE_COL_SINGULAR__APP_OPEN_CLICK_DATE_REV],
    REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_CONV: inputDf[REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_CONV],
    REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_REV: inputDf[REVENUE_COL_SINGULAR__APP_OPEN_CONV_DATE_REV],
    REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_SINGULAR_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_SINGULAR_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__ACQUISITIONS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__ACQUISITIONS_CONV_DATE_REV],
    REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_REDEMPTION_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_REDEMPTION_CONV_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_CONV_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SEASON_PASS_1_MONTH_CONV_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__MLS_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__MOVIE_PURCHASES_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__MOVIE_PURCHASES_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TRANSACTIONS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TRANSACTIONS_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TV_SHOW_PURCHASES_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TV_SUBSCRIPTIONS_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_AMPLIFY_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_ENTITLEMENTS_CONV_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__TVPLUS_SUBSCRIPTION_CONV_DATE_REV],
    REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_CONV: inputDf[REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_CONV],
    REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_REV: inputDf[REVENUE_COL_VIDEO__VIDEO_RENTALS_CLICK_DATE_REV],
    REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_CONV: inputDf[REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_CONV],
    REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_REV: inputDf[REVENUE_COL_VIDEO__VIDEO_RENTALS_CONV_DATE_REV]
})

testIosDownloads = 'iOS App Store Downloads'
testIosInAppPurchases = 'iOS App Store InApp Purchases'
testIosRedownloads = 'iOS App Store Redownload'
testMacDownloads = 'Mac App Store Downloads'
testMacRedownloads = 'Mac App Store Redownload'
testMusicSubs = 'Music Subscriptions'
testMusicRedemptions = 'Music Redemptions'
testAppleOneSubs = 'Apple One Subscription'
testAppleVoiceSubs = 'Apple Voice Subscription'
testArcadeSubscriptions = 'Arcade Subscriptions'
testAudioBook = 'Audiobook'
testBookPurchases = 'Book Purchases'
testFamily = '&adamid=1633688741'
testFamily2 = '&adamid=6450018329'
testPremier = '&adamid=1633697974'
testPremier2 = '&adamid=6450018727'
testIndividual = '&adamid=1633537299'
testIndividual2 = '&adamid=6450018439'
testTvPlusSubs = 'TVPlus Subscription'
testTvPlusEntitlements = 'TVPlus Entitlements'
testTvSubs = 'TV Subscription'
testVideoRentals = 'Video Rentals'
testMoviePurchases = 'Movie Purchases'
testTvShowPurchases = 'TV Show Purchases'
testNewsSubs = 'News Subscriptions'
testNewsAmplifySubs = 'News Amplify Subscriptions'
testMLBSubs = 'MLS subscription'
testMLSRedemption = 'MLS Redemption'
testMLS1MonthPass =  '&adamid=6445132388'
testMLSSeasonPass = '&adamid=6445132219'
testPurchase = 'iCloud%20Purchase'
testPurchase2 = 'iCloud Purchase'
test50GB = '&adamid=916860110'
test200GB = '&adamid=916860120'
test2000GB = '&adamid=1148689470'
test50GB = '&adamid=916860110'
test200GB = '&adamid=916860120'
test2000GB = '&adamid=1148689470'
test6TB = '&adamid=1694069019'
test12TB = '&adamid=1694069099'
test50GBAlternate = '&adamid=6449562876'
test200GBAlternate = '&adamid=6449562682'
test2000GBAlternate = '&adamid=6449562677'
test6TBAlternate = '&adamid=6449562388'
test12TBAlternate = '&adamid=6449562552'
testRedemption = 'iCloud%20Redemption'
testRedemption2 = 'iCloud Redemption'
testPromotedIosDownloadsIosRedownloads = '&adamid=1598433714'
testTVPlusAmplifySubscription = 'TVPlus Amplify Subscription'

def try_process_row(inputCol):
  try:
    return process_row(inputCol)
  except Exception as e:
    # Log the exception if needed
    print(f"Error processing row: {e}")
    return None


def process_row(inputCol):
    # Check if productString contains testRedemption or testRedemption2
    productString = str(inputCol['Product ID'])
    if testRedemption in productString or testRedemption2 in productString:
        return None 

    outputCol = inputCol.copy() 
    keywordID = str(inputCol['Keyword ID'])
    adID = str(inputCol['Creative ID'])
    outputCol['Keyword ID'] = ''
    outputCol['Creative ID']  = ''

    testClickDate = inputCol['Singular subscription (Click Date) Conv']
    testConvDate = inputCol['Singular subscription (Conv Date) Conv']

    outputCol[REVENUE_COL_ADEXTENSION_ID] = inputCol[REVENUE_COL_SL_ID]
    # Logic to set proper Keyword ID
    if keywordID.find('yj-') >= 0:
        outputCol['Keyword'] = keywordID.replace('yj-', '')
    else:
        values = keywordID.split('_')
        length = len(values)
        if length == 2:
            outputCol['Keyword ID'] = values[0].replace('b-', '')
        elif length >= 3:
            outputCol['Group ID'] = values[0]
            outputCol['Target IDs'] = values[1]
            outputCol['Keyword ID'] = values[2]

    # Logic to set proper Creative ID
    if adID.find('-yjc') >= 0:
        values = adID.split('-yjc')[1].split('_')
        outputCol['Keyword ID'] = values[1]
        outputCol['Match Type'] = values[2].split('-')[0]
        outputCol['Device'] = values[2].split('-')[1]
    else:
        values = adID.split('-')
        if len(values) >= 3:
            if 'iCloud' in productString:
              outputCol['Creative ID'] = values[3]
              outputCol['Device'] = values[4]
            else:
              outputCol['Creative ID'] = values[1]
              outputCol['Device'] = values[2]

    if testIosDownloads in productString:
      if testConvDate != '':
        outputCol['APP STORE - iOS Downloads (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APP STORE - iOS Downloads (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APP STORE - iOS Downloads (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APP STORE - iOS Downloads (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testIosInAppPurchases in productString:
      if testConvDate != '':
        outputCol['APP STORE - iOS InApp Purchases (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APP STORE - iOS InApp Purchases (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APP STORE - iOS InApp Purchases (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APP STORE - iOS InApp Purchases (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testIosRedownloads in productString:
      if testConvDate != '':
        outputCol['APP STORE - iOS Redownload (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APP STORE - iOS Redownload (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APP STORE - iOS Redownload (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APP STORE - iOS Redownload (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMacDownloads in productString:
      if testConvDate != '':
        outputCol['APP STORE - Mac Downloads (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APP STORE - Mac Downloads (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APP STORE - Mac Downloads (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APP STORE - Mac Downloads (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMacRedownloads in productString:
      if testConvDate != '':
        outputCol['APP STORE - Mac Redownload (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APP STORE - Mac Redownload (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APP STORE - Mac Redownload (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APP STORE - Mac Redownload (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMusicSubs in productString:
      if testConvDate != '':
        outputCol['Music Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Music Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Music Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Music Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMusicRedemptions in productString:
      if testConvDate != '':
        outputCol['Music Redemption (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Music Redemption (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Music Redemption (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Music Redemption (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMLBSubs in productString:
      if testConvDate != '':
        outputCol['VIDEO - MLS Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - MLS Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - MLS Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - MLS Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMLSRedemption in productString:
      if testConvDate != '':
        outputCol['VIDEO - MLS Redemption (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - MLS Redemption (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - MLS Redemption (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - MLS Redemption (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMLSSeasonPass in productString:
      if testConvDate != '':
        outputCol['VIDEO - MLS Season Pass (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - MLS Season Pass (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - MLS Season Pass (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - MLS Season Pass (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testMLS1MonthPass in productString:
      if testConvDate != '':
        outputCol['VIDEO - MLS Season Pass 1 Month (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - MLS Season Pass 1 Month (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - MLS Season Pass 1 Month (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - MLS Season Pass 1 Month (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testAppleOneSubs in productString:
      if testConvDate != '':
        outputCol['Apple One Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Apple One Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testArcadeSubscriptions in productString:
      if testConvDate != '':
        outputCol['ARCADE - Subscriptions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['ARCADE - Subscriptions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['ARCADE - Subscriptions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['ARCADE - Subscriptions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testAppleVoiceSubs in productString:
      if testConvDate != '':
        outputCol['Apple Voice Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple Voice Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Apple Voice Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple Voice Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testAudioBook in productString:
      if testConvDate != '':
        outputCol['Audiobook Purchases (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Audiobook Purchases (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

        revenue = inputCol['Singular subscription (Conv Date) Rev']

        if revenue == '':
          outputCol['Audiobook Purchases - Free (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']

        else:
          outputCol['Audiobook Purchases - Paid (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
          outputCol['Audiobook Purchases - Paid (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Audiobook Purchases (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Audiobook Purchases (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        revenue = inputCol['Singular subscription (Click Date) Rev']

        if revenue == '':
          outputCol['Audiobook Purchases - Free (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']

        else:
          outputCol['Audiobook Purchases - Paid (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Audiobook Purchases - Paid (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testBookPurchases in productString:
      if testConvDate != '':
        outputCol['Book Purchases (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Book Purchases (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

        revenue = inputCol['Singular subscription (Conv Date) Rev']

        if revenue == '':
          outputCol['Book Purchases - Free (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']

        else:
          outputCol['Book Purchases - Paid (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
          outputCol['Book Purchases - Paid (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Book Purchases (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Book Purchases (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        revenue = inputCol['Singular subscription (Click Date) Rev']

        if revenue == '':
          outputCol['Book Purchases - Free (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']

        else:
          outputCol['Book Purchases - Paid (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Book Purchases - Paid (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testFamily in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Family (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Family (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Family (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Family (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testPremier in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Premier (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Premier (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Premier (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Premier (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testIndividual in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Individual (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Individual (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Individual (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Individual (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testFamily2 in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Family (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Family (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Family (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Family (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testPremier2 in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Premier (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Premier (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Premier (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Premier (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testIndividual2 in productString:
      if testConvDate != '':
        outputCol['APPLE ONE - Combined (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['APPLE ONE - Combined (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['Apple One - Individual (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Apple One - Individual (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['APPLE ONE - Combined (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['APPLE ONE - Combined (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['Apple One - Individual (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple One - Individual (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testTvPlusSubs in productString:
      if testConvDate != '':
        outputCol['VIDEO - TVPlus Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - TVPlus Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Acquisitions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Acquisitions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - TVPlus Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - TVPlus Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Acquisitions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Acquisitions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testTvPlusEntitlements in productString:
      if testConvDate != '':
        outputCol['VIDEO - TVPlus Entitlements (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - TVPlus Entitlements (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Acquisitions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Acquisitions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - TVPlus Entitlements (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - TVPlus Entitlements (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Acquisitions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Acquisitions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testTvSubs in productString:
      if testConvDate != '':
        outputCol['VIDEO - TV Subscriptions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - TV Subscriptions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Acquisitions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Acquisitions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - TV Subscriptions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - TV Subscriptions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Acquisitions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Acquisitions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testVideoRentals in productString:
      if testConvDate != '':
        outputCol['VIDEO - Video Rentals (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Video Rentals (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - Video Rentals (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Video Rentals (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

    if testMoviePurchases in productString:
      if testConvDate != '':
        outputCol['VIDEO - Movie Purchases (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Movie Purchases (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - Movie Purchases (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Movie Purchases (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

    if testTvShowPurchases in productString:
      if testConvDate != '':
        outputCol['VIDEO - TV Show Purchases (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - TV Show Purchases (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['VIDEO - TV Show Purchases (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - TV Show Purchases (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Transactions (Click Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Transactions (Click Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

    if testNewsSubs in productString:
      if testConvDate != '':
        outputCol['News Subscriptions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['News Subscriptions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['News Subscriptions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['News Subscriptions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testNewsAmplifySubs in productString:
      if testConvDate != '':
        outputCol['News Amplify Subscriptions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['News Amplify Subscriptions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['News Amplify Subscriptions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['News Amplify Subscriptions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testPurchase in productString or testPurchase2 in productString:
      if testClickDate != '':
        outputCol['Apple iCloud Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Apple iCloud Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        revenue = inputCol['Singular subscription (Click Date) Rev']
        if revenue == '':
          outputCol['Apple iCloud - Free (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']

        if revenue != '':
          outputCol['Apple iCloud - Paid (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Apple iCloud - Paid (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        if test50GB in productString or test50GBAlternate in productString:
          outputCol['Apple iCloud 50GB Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Apple iCloud 50GB Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        if test200GB in productString or test200GBAlternate in productString:
          outputCol['Apple iCloud 200GB Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Apple iCloud 200GB Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        if test2000GB in productString or test2000GBAlternate in productString:
          outputCol['Apple iCloud 2000GB Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['Apple iCloud 2000GB Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        if test6TB in productString or test6TBAlternate in productString:
          outputCol['iCloud - iCloud 6TB Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['iCloud - iCloud 6TB Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

        if test12TB in productString or test12TBAlternate in productString:
          outputCol['iCloud - iCloud 12TB Sign Up (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
          outputCol['iCloud - iCloud 12TB Sign Up (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testPromotedIosDownloadsIosRedownloads in productString:
      if testConvDate != '':
        outputCol['Promoted App Installs (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Promoted App Installs (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Promoted App Installs (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Promoted App Installs (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']

    if testTVPlusAmplifySubscription in productString:
      if testConvDate != '':
        outputCol['Video - TVPlus Amplify Subscription (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['Video - TVPlus Amplify Subscription (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']
        outputCol['VIDEO - Acquisitions (Conv Date) Conv'] = inputCol['Singular subscription (Conv Date) Conv']
        outputCol['VIDEO - Acquisitions (Conv Date) Rev'] = inputCol['Singular subscription (Conv Date) Rev']

      if testClickDate != '':
        outputCol['Video - TVPlus Amplify Subscription (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['Video - TVPlus Amplify Subscription (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
        outputCol['VIDEO - Acquisitions (Click Date) Conv'] = inputCol['Singular subscription (Click Date) Conv']
        outputCol['VIDEO - Acquisitions (Click Date) Rev'] = inputCol['Singular subscription (Click Date) Rev']
    return outputCol



#allow for custom output columns
skip_output_validations = True
inputColumn = [
  'Date','Keyword ID','Creative ID','Keyword','Match Type','Device','Product ID','Conversions','Revenue','Currency','SL ID',
  'APP STORE - Mac Downloads (Click Date) Conv','APP STORE - Mac Downloads (Click Date) Rev','APP STORE - Mac Downloads (Conv Date) Conv','APP STORE - Mac Downloads (Conv Date) Rev',
  'APP STORE - Mac Redownload (Click Date) Conv','APP STORE - Mac Redownload (Click Date) Rev','APP STORE - Mac Redownload (Conv Date) Conv','APP STORE - Mac Redownload (Conv Date) Rev',
  'APP STORE - iOS Downloads (Click Date) Conv','APP STORE - iOS Downloads (Click Date) Rev','APP STORE - iOS Downloads (Conv Date) Conv','APP STORE - iOS Downloads (Conv Date) Rev',
  'APP STORE - iOS InApp Purchases (Click Date) Conv','APP STORE - iOS InApp Purchases (Click Date) Rev','APP STORE - iOS InApp Purchases (Conv Date) Conv','APP STORE - iOS InApp Purchases (Conv Date) Rev',
  'APP STORE - iOS Redownload (Click Date) Conv','APP STORE - iOS Redownload (Click Date) Rev','APP STORE - iOS Redownload (Conv Date) Conv','APP STORE - iOS Redownload (Conv Date) Rev',
  'APPLE ONE - Combined (Click Date) Conv','APPLE ONE - Combined (Click Date) Rev','APPLE ONE - Combined (Conv Date) Conv','APPLE ONE - Combined (Conv Date) Rev',
  'ARCADE - Subscriptions (Click Date) Conv','ARCADE - Subscriptions (Click Date) Rev','ARCADE - Subscriptions (Conv Date) Conv','ARCADE - Subscriptions (Conv Date) Rev',
  'Apple One - Family (Click Date) Conv','Apple One - Family (Click Date) Rev','Apple One - Family (Conv Date) Conv','Apple One - Family (Conv Date) Rev',
  'Apple One - Individual (Click Date) Conv','Apple One - Individual (Click Date) Rev','Apple One - Individual (Conv Date) Conv','Apple One - Individual (Conv Date) Rev',
  'Apple One - Premier (Click Date) Conv','Apple One - Premier (Click Date) Rev','Apple One - Premier (Conv Date) Conv','Apple One - Premier (Conv Date) Rev',
  'Apple One Subscription (Click Date) Conv','Apple One Subscription (Click Date) Rev','Apple One Subscription (Conv Date) Conv','Apple One Subscription (Conv Date) Rev',
  'Apple Voice Subscription (Click Date) Conv','Apple Voice Subscription (Click Date) Rev','Apple Voice Subscription (Conv Date) Conv','Apple Voice Subscription (Conv Date) Rev',
  'Audiobook Purchases (Click Date) Conv','Audiobook Purchases (Click Date) Rev','Audiobook Purchases (Conv Date) Conv','Audiobook Purchases (Conv Date) Rev','Audiobook Purchases - Free (Click Date) Conv','Audiobook Purchases - Free (Click Date) Rev',
  'Audiobook Purchases - Free (Conv Date) Conv','Audiobook Purchases - Free (Conv Date) Rev','Audiobook Purchases - Paid (Click Date) Conv','Audiobook Purchases - Paid (Click Date) Rev','Audiobook Purchases - Paid (Conv Date) Conv','Audiobook Purchases - Paid (Conv Date) Rev',
  'Book Purchases (Click Date) Conv','Book Purchases (Click Date) Rev','Book Purchases (Conv Date) Conv','Book Purchases (Conv Date) Rev',
  'Book Purchases - Free (Click Date) Conv','Book Purchases - Free (Click Date) Rev','Book Purchases - Free (Conv Date) Conv','Book Purchases - Free (Conv Date) Rev',
  'Book Purchases - Paid (Click Date) Conv','Book Purchases - Paid (Click Date) Rev','Book Purchases - Paid (Conv Date) Conv','Book Purchases - Paid (Conv Date) Rev',
  'Music Redemption (Click Date) Conv','Music Redemption (Click Date) Rev','Music Redemption (Conv Date) Conv','Music Redemption (Conv Date) Rev',
  'Music Subscription (Click Date) Conv','Music Subscription (Click Date) Rev','Music Subscription (Conv Date) Conv','Music Subscription (Conv Date) Rev',
  'News Amplify Subscriptions (Click Date) Conv','News Amplify Subscriptions (Click Date) Rev','News Amplify Subscriptions (Conv Date) Conv','News Amplify Subscriptions (Conv Date) Rev',
  'News Subscriptions (Click Date) Conv','News Subscriptions (Click Date) Rev','News Subscriptions (Conv Date) Conv','News Subscriptions (Conv Date) Rev',
  'Promoted App Installs (Click Date) Conv','Promoted App Installs (Click Date) Rev','Promoted App Installs (Conv Date) Conv','Promoted App Installs (Conv Date) Rev',
  'Singular - App Open (Click Date) Conv','Singular - App Open (Click Date) Rev','Singular - App Open (Conv Date) Conv','Singular - App Open (Conv Date) Rev',
  'Singular subscription (Click Date) Conv','Singular subscription (Click Date) Rev','Singular subscription (Conv Date) Conv','Singular subscription (Conv Date) Rev',
  'Tot. (Conv Date) Conv','Tot. (Conv Date) Rev',
  'VIDEO - Acquisitions (Click Date) Conv','VIDEO - Acquisitions (Click Date) Rev','VIDEO - Acquisitions (Conv Date) Conv','VIDEO - Acquisitions (Conv Date) Rev',
  'VIDEO - MLS Redemption (Click Date) Conv','VIDEO - MLS Redemption (Click Date) Rev','VIDEO - MLS Redemption (Conv Date) Conv','VIDEO - MLS Redemption (Conv Date) Rev',
  'VIDEO - MLS Season Pass (Click Date) Conv','VIDEO - MLS Season Pass (Click Date) Rev','VIDEO - MLS Season Pass (Conv Date) Conv','VIDEO - MLS Season Pass (Conv Date) Rev',
  'VIDEO - MLS Season Pass 1 Month (Click Date) Conv','VIDEO - MLS Season Pass 1 Month (Click Date) Rev','VIDEO - MLS Season Pass 1 Month (Conv Date) Conv','VIDEO - MLS Season Pass 1 Month (Conv Date) Rev',
  'VIDEO - MLS Subscription (Click Date) Conv','VIDEO - MLS Subscription (Click Date) Rev','VIDEO - MLS Subscription (Conv Date) Conv','VIDEO - MLS Subscription (Conv Date) Rev',
  'VIDEO - Movie Purchases (Click Date) Conv','VIDEO - Movie Purchases (Click Date) Rev','VIDEO - Movie Purchases (Conv Date) Conv','VIDEO - Movie Purchases (Conv Date) Rev',
  'VIDEO - TV Show Purchases (Click Date) Conv','VIDEO - TV Show Purchases (Click Date) Rev','VIDEO - TV Show Purchases (Conv Date) Conv','VIDEO - TV Show Purchases (Conv Date) Rev',
  'VIDEO - TV Subscriptions (Click Date) Conv','VIDEO - TV Subscriptions (Click Date) Rev','VIDEO - TV Subscriptions (Conv Date) Conv','VIDEO - TV Subscriptions (Conv Date) Rev',
  'VIDEO - TVPlus Entitlements (Click Date) Conv','VIDEO - TVPlus Entitlements (Click Date) Rev','VIDEO - TVPlus Entitlements (Conv Date) Conv','VIDEO - TVPlus Entitlements (Conv Date) Rev',
  'VIDEO - TVPlus Subscription (Click Date) Conv','VIDEO - TVPlus Subscription (Click Date) Rev','VIDEO - TVPlus Subscription (Conv Date) Conv','VIDEO - TVPlus Subscription (Conv Date) Rev',
  'VIDEO - Transactions (Click Date) Conv','VIDEO - Transactions (Click Date) Rev','VIDEO - Transactions (Conv Date) Conv','VIDEO - Transactions (Conv Date) Rev',
  'VIDEO - Video Rentals (Click Date) Conv','VIDEO - Video Rentals (Click Date) Rev','VIDEO - Video Rentals (Conv Date) Conv','VIDEO - Video Rentals (Conv Date) Rev',
  'Video - TVPlus Amplify Subscription (Click Date) Conv','Video - TVPlus Amplify Subscription (Click Date) Rev','Video - TVPlus Amplify Subscription (Conv Date) Conv','Video - TVPlus Amplify Subscription (Conv Date) Rev',
  'Group ID','Target IDs'
]

# user code start here
processed_df = inputDf[inputColumn].fillna('').apply(try_process_row, axis=1, result_type='expand')

outputColumn = [
  'Date','Keyword ID','Creative ID','Keyword','Match Type','Device','Product ID','Conversions','Revenue','Currency','AdExtension ID',
  'APP STORE - Mac Downloads (Click Date) Conv','APP STORE - Mac Downloads (Click Date) Rev','APP STORE - Mac Downloads (Conv Date) Conv','APP STORE - Mac Downloads (Conv Date) Rev',
  'APP STORE - Mac Redownload (Click Date) Conv','APP STORE - Mac Redownload (Click Date) Rev','APP STORE - Mac Redownload (Conv Date) Conv','APP STORE - Mac Redownload (Conv Date) Rev',
  'APP STORE - iOS Downloads (Click Date) Conv','APP STORE - iOS Downloads (Click Date) Rev','APP STORE - iOS Downloads (Conv Date) Conv','APP STORE - iOS Downloads (Conv Date) Rev',
  'APP STORE - iOS InApp Purchases (Click Date) Conv','APP STORE - iOS InApp Purchases (Click Date) Rev','APP STORE - iOS InApp Purchases (Conv Date) Conv','APP STORE - iOS InApp Purchases (Conv Date) Rev',
  'APP STORE - iOS Redownload (Click Date) Conv','APP STORE - iOS Redownload (Click Date) Rev','APP STORE - iOS Redownload (Conv Date) Conv','APP STORE - iOS Redownload (Conv Date) Rev',
  'APPLE ONE - Combined (Click Date) Conv','APPLE ONE - Combined (Click Date) Rev','APPLE ONE - Combined (Conv Date) Conv','APPLE ONE - Combined (Conv Date) Rev',
  'ARCADE - Subscriptions (Click Date) Conv','ARCADE - Subscriptions (Click Date) Rev','ARCADE - Subscriptions (Conv Date) Conv','ARCADE - Subscriptions (Conv Date) Rev',
  'Apple One - Family (Click Date) Conv','Apple One - Family (Click Date) Rev','Apple One - Family (Conv Date) Conv','Apple One - Family (Conv Date) Rev',
  'Apple One - Individual (Click Date) Conv','Apple One - Individual (Click Date) Rev','Apple One - Individual (Conv Date) Conv','Apple One - Individual (Conv Date) Rev',
  'Apple One - Premier (Click Date) Conv','Apple One - Premier (Click Date) Rev','Apple One - Premier (Conv Date) Conv','Apple One - Premier (Conv Date) Rev',
  'Apple One Subscription (Click Date) Conv','Apple One Subscription (Click Date) Rev','Apple One Subscription (Conv Date) Conv','Apple One Subscription (Conv Date) Rev',
  'Apple Voice Subscription (Click Date) Conv','Apple Voice Subscription (Click Date) Rev','Apple Voice Subscription (Conv Date) Conv','Apple Voice Subscription (Conv Date) Rev',
  'Audiobook Purchases (Click Date) Conv','Audiobook Purchases (Click Date) Rev','Audiobook Purchases (Conv Date) Conv','Audiobook Purchases (Conv Date) Rev',
  'Audiobook Purchases - Free (Click Date) Conv','Audiobook Purchases - Free (Click Date) Rev','Audiobook Purchases - Free (Conv Date) Conv','Audiobook Purchases - Free (Conv Date) Rev',
  'Audiobook Purchases - Paid (Click Date) Conv','Audiobook Purchases - Paid (Click Date) Rev','Audiobook Purchases - Paid (Conv Date) Conv','Audiobook Purchases - Paid (Conv Date) Rev',
  'Book Purchases (Click Date) Conv','Book Purchases (Click Date) Rev','Book Purchases (Conv Date) Conv','Book Purchases (Conv Date) Rev',
  'Book Purchases - Free (Click Date) Conv','Book Purchases - Free (Click Date) Rev','Book Purchases - Free (Conv Date) Conv','Book Purchases - Free (Conv Date) Rev',
  'Book Purchases - Paid (Click Date) Conv','Book Purchases - Paid (Click Date) Rev','Book Purchases - Paid (Conv Date) Conv','Book Purchases - Paid (Conv Date) Rev',
  'Music Redemption (Click Date) Conv','Music Redemption (Click Date) Rev','Music Redemption (Conv Date) Conv','Music Redemption (Conv Date) Rev',
  'Music Subscription (Click Date) Conv','Music Subscription (Click Date) Rev','Music Subscription (Conv Date) Conv','Music Subscription (Conv Date) Rev',
  'News Amplify Subscriptions (Click Date) Conv','News Amplify Subscriptions (Click Date) Rev','News Amplify Subscriptions (Conv Date) Conv','News Amplify Subscriptions (Conv Date) Rev',
  'News Subscriptions (Click Date) Conv','News Subscriptions (Click Date) Rev','News Subscriptions (Conv Date) Conv','News Subscriptions (Conv Date) Rev',
  'Promoted App Installs (Click Date) Conv','Promoted App Installs (Click Date) Rev','Promoted App Installs (Conv Date) Conv','Promoted App Installs (Conv Date) Rev',
  'Singular - App Open (Click Date) Conv','Singular - App Open (Click Date) Rev','Singular - App Open (Conv Date) Conv','Singular - App Open (Conv Date) Rev',
  'Singular subscription (Click Date) Conv','Singular subscription (Click Date) Rev','Singular subscription (Conv Date) Conv','Singular subscription (Conv Date) Rev',
  'Tot. (Conv Date) Conv','Tot. (Conv Date) Rev',
  'VIDEO - Acquisitions (Click Date) Conv','VIDEO - Acquisitions (Click Date) Rev','VIDEO - Acquisitions (Conv Date) Conv','VIDEO - Acquisitions (Conv Date) Rev',
  'VIDEO - MLS Redemption (Click Date) Conv','VIDEO - MLS Redemption (Click Date) Rev','VIDEO - MLS Redemption (Conv Date) Conv','VIDEO - MLS Redemption (Conv Date) Rev',
  'VIDEO - MLS Season Pass (Click Date) Conv','VIDEO - MLS Season Pass (Click Date) Rev','VIDEO - MLS Season Pass (Conv Date) Conv','VIDEO - MLS Season Pass (Conv Date) Rev',
  'VIDEO - MLS Season Pass 1 Month (Click Date) Conv','VIDEO - MLS Season Pass 1 Month (Click Date) Rev','VIDEO - MLS Season Pass 1 Month (Conv Date) Conv','VIDEO - MLS Season Pass 1 Month (Conv Date) Rev',
  'VIDEO - MLS Subscription (Click Date) Conv','VIDEO - MLS Subscription (Click Date) Rev','VIDEO - MLS Subscription (Conv Date) Conv','VIDEO - MLS Subscription (Conv Date) Rev',
  'VIDEO - Movie Purchases (Click Date) Conv','VIDEO - Movie Purchases (Click Date) Rev','VIDEO - Movie Purchases (Conv Date) Conv','VIDEO - Movie Purchases (Conv Date) Rev',
  'VIDEO - TV Show Purchases (Click Date) Conv','VIDEO - TV Show Purchases (Click Date) Rev','VIDEO - TV Show Purchases (Conv Date) Conv','VIDEO - TV Show Purchases (Conv Date) Rev',
  'VIDEO - TV Subscriptions (Click Date) Conv','VIDEO - TV Subscriptions (Click Date) Rev','VIDEO - TV Subscriptions (Conv Date) Conv','VIDEO - TV Subscriptions (Conv Date) Rev',
  'VIDEO - TVPlus Entitlements (Click Date) Conv','VIDEO - TVPlus Entitlements (Click Date) Rev','VIDEO - TVPlus Entitlements (Conv Date) Conv','VIDEO - TVPlus Entitlements (Conv Date) Rev',
  'VIDEO - TVPlus Subscription (Click Date) Conv','VIDEO - TVPlus Subscription (Click Date) Rev','VIDEO - TVPlus Subscription (Conv Date) Conv','VIDEO - TVPlus Subscription (Conv Date) Rev',
  'VIDEO - Transactions (Click Date) Conv','VIDEO - Transactions (Click Date) Rev','VIDEO - Transactions (Conv Date) Conv','VIDEO - Transactions (Conv Date) Rev','VIDEO - Video Rentals (Click Date) Conv',
  'VIDEO - Video Rentals (Click Date) Rev','VIDEO - Video Rentals (Conv Date) Conv','VIDEO - Video Rentals (Conv Date) Rev','Video - TVPlus Amplify Subscription (Click Date) Conv',
  'Video - TVPlus Amplify Subscription (Click Date) Rev','Video - TVPlus Amplify Subscription (Conv Date) Conv','Video - TVPlus Amplify Subscription (Conv Date) Rev',
  'Apple iCloud Sign Up (Click Date) Conv','Apple iCloud Sign Up (Click Date) Rev','Apple iCloud Sign Up (Conv Date) Conv','Apple iCloud Sign Up (Conv Date) Rev',
  'Apple iCloud 50GB Sign Up (Click Date) Conv','Apple iCloud 50GB Sign Up (Click Date) Rev','Apple iCloud 50GB Sign Up (Conv Date) Conv','Apple iCloud 50GB Sign Up (Conv Date) Rev',
  'Apple iCloud 200GB Sign Up (Click Date) Conv', 'Apple iCloud 200GB Sign Up (Click Date) Rev', 'Apple iCloud 200GB Sign Up (Conv Date) Conv', 'Apple iCloud 200GB Sign Up (Conv Date) Rev',
  'Apple iCloud 2000GB Sign Up (Click Date) Conv', 'Apple iCloud 2000GB Sign Up (Click Date) Rev', 'Apple iCloud 2000GB Sign Up (Conv Date) Conv', 'Apple iCloud 2000GB Sign Up (Conv Date) Rev',
  'iCloud - iCloud 6TB Sign Up (Click Date) Conv', 'iCloud - iCloud 6TB Sign Up (Click Date) Rev', 'iCloud - iCloud 6TB Sign Up (Conv Date) Conv' ,'iCloud - iCloud 6TB Sign Up (Conv Date) Rev',
  'iCloud - iCloud 12TB Sign Up (Click Date) Conv', 'iCloud - iCloud 12TB Sign Up (Click Date) Rev', 'iCloud - iCloud 12TB Sign Up (Conv Date) Conv', 'iCloud - iCloud 12TB Sign Up (Conv Date) Rev',
  'Apple iCloud - Paid (Click Date) Conv', 'Apple iCloud - Paid (Click Date) Rev', 'Apple iCloud - Paid (Conv Date) Conv', 'Apple iCloud - Paid (Conv Date) Rev',
  'Apple iCloud - Free (Click Date) Conv', 'Apple iCloud - Free (Click Date) Rev', 'Apple iCloud - Free (Conv Date) Conv', 'Apple iCloud - Free (Conv Date) Rev',
  'Group ID','Target IDs']


outputDf = processed_df.dropna(how='all').reindex(columns=outputColumn)

Post generated on 2025-03-11 01:25:51 GMT

comments powered by Disqus