Skip to content

Instantly share code, notes, and snippets.

@djfan
Created November 15, 2017 04:22
Show Gist options
  • Save djfan/1276e0a8d7a167e24f663dcc011b8bf9 to your computer and use it in GitHub Desktop.
Save djfan/1276e0a8d7a167e24f663dcc011b8bf9 to your computer and use it in GitHub Desktop.
import pandas as pd
add_input = './Desktop/DCM_output.xlsx'
sheet_name = 'Sheet1'
add_output2 = './Desktop/spendcleanoutput.xlsx'
df=pd.read_excel(add_input, sheetname=sheet_name)
df = df.dropna(how='all')
df.loc[df.Channel=='Display-TrueView',['Cost','Views','Clicks','Video played to 25%','Video played to 50%','Video played to 75%','Video played to 100%']] = 0
df.loc[(df['Partner Type'].isin(['Programmatic', 'Programmatic Video'])) & (df.Channel=='Display'), 'Cost']=0
df.to_excel(add_output2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment