Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion notebooks/ppc-examples-blank.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,25 @@
"campaign_weekday_performance[('Impressions', 0)]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There is another useful function for pivoting - pivot_table. Pivot function needs to aggregate data before pivoting and doesn't allow to work with duplicate column values. With pivot_table function you can aggregate data in one step."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"campaign_weekday_performance = ad_group_performance.pivot_table(index=['CampaignName', 'DayOfWeek'],\n",
" values=['Impressions', 'Clicks', 'Cost', 'Conversions', 'ConversionsValue'],\n",
" aggfunc=np.sum)\n",
"campaign_weekday_performance"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1088,7 +1107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
Loading