Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 82.24 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 3,
  6. "metadata": {
  7. "collapsed": false
  8. },
  9. "outputs": [
  10. {
  11. "data": {
  12. "text/html": [
  13. "<script>jQuery(function() {if (jQuery(\"body.notebook_app\").length == 0) { jQuery(\".input_area\").toggle(); jQuery(\".prompt\").toggle();}});</script>"
  14. ]
  15. },
  16. "metadata": {},
  17. "output_type": "display_data"
  18. },
  19. {
  20. "data": {
  21. "text/html": [
  22. "<button onclick=\"jQuery('.input_area').toggle(); jQuery('.prompt').toggle();\">Toggle code</button>"
  23. ]
  24. },
  25. "metadata": {},
  26. "output_type": "display_data"
  27. }
  28. ],
  29. "source": [
  30. "import IPython.core.display as di\n",
  31. "\n",
  32. "# This line will hide code by default when the notebook is exported as HTML\n",
  33. "di.display_html('<script>jQuery(function() {if (jQuery(\"body.notebook_app\").length == 0) { jQuery(\".input_area\").toggle(); jQuery(\".prompt\").toggle();}});</script>', raw=True)\n",
  34. "\n",
  35. "# This line will add a button to toggle visibility of code blocks, for use with the HTML export version\n",
  36. "di.display_html('''<button onclick=\"jQuery('.input_area').toggle(); jQuery('.prompt').toggle();\">Toggle code</button>''', raw=True)"
  37. ]
  38. },
  39. {
  40. "cell_type": "code",
  41. "execution_count": 4,
  42. "metadata": {
  43. "collapsed": true
  44. },
  45. "outputs": [],
  46. "source": [
  47. "from IPython.display import display, HTML\n",
  48. "from itertools import combinations, product"
  49. ]
  50. },
  51. {
  52. "cell_type": "code",
  53. "execution_count": 5,
  54. "metadata": {
  55. "collapsed": false
  56. },
  57. "outputs": [],
  58. "source": [
  59. "from jarvis.brain.utility.data_preparation import (get_metrics_single_date, get_metrics_date_range)\n",
  60. "import numpy as np\n",
  61. "import pandas as pd\n",
  62. "from sklearn import tree\n",
  63. "import pydotplus\n",
  64. "global_metrics = ['ga_cpt', 'fb_spend', 'ga_transactions', 'ga_revenue']\n",
  65. "goal_metric = 'ga_cpt'"
  66. ]
  67. },
  68. {
  69. "cell_type": "code",
  70. "execution_count": 6,
  71. "metadata": {
  72. "collapsed": true
  73. },
  74. "outputs": [],
  75. "source": [
  76. "start = '2017-02-21'\n",
  77. "end = '2017-03-21'\n",
  78. "df = get_metrics_date_range(15, 'ad', start, end, global_metrics, custom_tags=True, active=False)"
  79. ]
  80. },
  81. {
  82. "cell_type": "code",
  83. "execution_count": 7,
  84. "metadata": {
  85. "collapsed": false
  86. },
  87. "outputs": [],
  88. "source": [
  89. "df= df[df['App Type'] == 'Web']"
  90. ]
  91. },
  92. {
  93. "cell_type": "code",
  94. "execution_count": 8,
  95. "metadata": {
  96. "collapsed": true
  97. },
  98. "outputs": [],
  99. "source": [
  100. "excluded_tags = ['Campaigns', 'ad_id', 'Image', 'Adsets', 'start_date', '_id', 'Ads',\n",
  101. " 'end_date', 'Active Ads Count in Adset', 'Active Adsets Count in Campaign', 'Labels', 'audience type', 'audience category', 'Product Set',\n",
  102. " 'Prominent Text', 'Dominant Color', 'DominantColor', 'ProminentText', 'NumberofFaces', 'Number of Faces', 'Sale', 'name', 'Carousel Count']"
  103. ]
  104. },
  105. {
  106. "cell_type": "code",
  107. "execution_count": 9,
  108. "metadata": {
  109. "collapsed": true
  110. },
  111. "outputs": [],
  112. "source": [
  113. "def exclude_single_dominant_tag(tags, df):\n",
  114. " all_tags = []\n",
  115. " total_spend = df.fb_spend.sum()\n",
  116. " for tag in tags:\n",
  117. " grp = df.groupby(tag).sum()\n",
  118. " grp['prop'] = grp.fb_spend / total_spend\n",
  119. " if pd.np.max(grp['prop']) > 0.95:\n",
  120. " print(tag)\n",
  121. " continue\n",
  122. " all_tags.append(tag)\n",
  123. " return all_tags\n",
  124. "def clean_tags(df, excluded_tags, global_metrics):\n",
  125. " all_tags = list(set(df.columns) - set(global_metrics) - set(excluded_tags))\n",
  126. " all_tags = [tag for tag in all_tags if len(df[df[tag] != 'None'][tag].unique()) > 1]\n",
  127. " all_tags = [tag for tag in all_tags if df[tag].count() > 0.25*len(df)]\n",
  128. " all_tags = exclude_single_dominant_tag(all_tags, df) \n",
  129. " return all_tags"
  130. ]
  131. },
  132. {
  133. "cell_type": "code",
  134. "execution_count": 10,
  135. "metadata": {
  136. "collapsed": false
  137. },
  138. "outputs": [
  139. {
  140. "name": "stdout",
  141. "output_type": "stream",
  142. "text": [
  143. "Call To Action\n",
  144. "Behaviors\n",
  145. "Gender\n",
  146. "Lookalike Types\n",
  147. "Locations\n",
  148. "Device Platforms\n",
  149. "User OS\n",
  150. "Billing Event\n",
  151. "Optimization Goal\n"
  152. ]
  153. }
  154. ],
  155. "source": [
  156. "all_tags = clean_tags(df, excluded_tags, global_metrics)"
  157. ]
  158. },
  159. {
  160. "cell_type": "markdown",
  161. "metadata": {},
  162. "source": [
  163. "### Tags after cleanup"
  164. ]
  165. },
  166. {
  167. "cell_type": "code",
  168. "execution_count": 11,
  169. "metadata": {
  170. "collapsed": false
  171. },
  172. "outputs": [
  173. {
  174. "data": {
  175. "text/plain": [
  176. "['Publisher Platforms',\n",
  177. " 'Facebook Positions',\n",
  178. " 'Audience Strategy',\n",
  179. " 'Interests',\n",
  180. " 'Ad Format',\n",
  181. " 'Landing Pages',\n",
  182. " 'Audience Types',\n",
  183. " 'Custom Audiences',\n",
  184. " 'Campaign Objective',\n",
  185. " 'Ad Type',\n",
  186. " 'Age Range']"
  187. ]
  188. },
  189. "execution_count": 11,
  190. "metadata": {},
  191. "output_type": "execute_result"
  192. }
  193. ],
  194. "source": [
  195. "all_tags"
  196. ]
  197. },
  198. {
  199. "cell_type": "code",
  200. "execution_count": 13,
  201. "metadata": {
  202. "collapsed": true
  203. },
  204. "outputs": [],
  205. "source": [
  206. "df_org = df.copy()"
  207. ]
  208. },
  209. {
  210. "cell_type": "code",
  211. "execution_count": 14,
  212. "metadata": {
  213. "collapsed": false
  214. },
  215. "outputs": [],
  216. "source": [
  217. "df = df_org[df_org['App Type'] == 'Web']"
  218. ]
  219. },
  220. {
  221. "cell_type": "code",
  222. "execution_count": 15,
  223. "metadata": {
  224. "collapsed": true
  225. },
  226. "outputs": [],
  227. "source": [
  228. "df_global = df.copy()"
  229. ]
  230. },
  231. {
  232. "cell_type": "code",
  233. "execution_count": 16,
  234. "metadata": {
  235. "collapsed": false
  236. },
  237. "outputs": [],
  238. "source": [
  239. "total_spend = df_global.fb_spend.sum()"
  240. ]
  241. },
  242. {
  243. "cell_type": "code",
  244. "execution_count": 17,
  245. "metadata": {
  246. "collapsed": false
  247. },
  248. "outputs": [],
  249. "source": [
  250. "tag_scores = {}\n",
  251. "for tag in all_tags:\n",
  252. " temp = df.groupby([tag]).sum()\n",
  253. " temp['prop'] = temp['fb_spend'] / total_spend\n",
  254. " tag_scores[tag] = temp[temp.index != 'None']['prop'].mean()"
  255. ]
  256. },
  257. {
  258. "cell_type": "markdown",
  259. "metadata": {},
  260. "source": [
  261. "### Scores"
  262. ]
  263. },
  264. {
  265. "cell_type": "code",
  266. "execution_count": 18,
  267. "metadata": {
  268. "collapsed": false
  269. },
  270. "outputs": [
  271. {
  272. "data": {
  273. "text/plain": [
  274. "[('Interests', 0.006639045623801028),\n",
  275. " ('Custom Audiences', 0.01184565403443271),\n",
  276. " ('Landing Pages', 0.012984133367588177),\n",
  277. " ('Age Range', 0.029411764705882373),\n",
  278. " ('Audience Types', 0.12360931022943827),\n",
  279. " ('Facebook Positions', 0.1999617738778404),\n",
  280. " ('Campaign Objective', 0.2000000000000001),\n",
  281. " ('Publisher Platforms', 0.2499522173473005),\n",
  282. " ('Ad Type', 0.33325942310142975),\n",
  283. " ('Ad Format', 0.33325942310142986),\n",
  284. " ('Audience Strategy', 0.5000000000000001)]"
  285. ]
  286. },
  287. "execution_count": 18,
  288. "metadata": {},
  289. "output_type": "execute_result"
  290. }
  291. ],
  292. "source": [
  293. "import operator\n",
  294. "sorted(tag_scores.items(), key=operator.itemgetter(1))"
  295. ]
  296. },
  297. {
  298. "cell_type": "code",
  299. "execution_count": 19,
  300. "metadata": {
  301. "collapsed": false
  302. },
  303. "outputs": [],
  304. "source": [
  305. "score_df = pd.DataFrame().from_dict(tag_scores, orient='index')\n",
  306. "score_df = score_df.rename(columns = {0:'score'})"
  307. ]
  308. },
  309. {
  310. "cell_type": "code",
  311. "execution_count": 20,
  312. "metadata": {
  313. "collapsed": true
  314. },
  315. "outputs": [],
  316. "source": [
  317. "score_df = score_df[pd.notnull(score_df['score'])]"
  318. ]
  319. },
  320. {
  321. "cell_type": "code",
  322. "execution_count": 21,
  323. "metadata": {
  324. "collapsed": true
  325. },
  326. "outputs": [],
  327. "source": [
  328. "num_levels = 4"
  329. ]
  330. },
  331. {
  332. "cell_type": "code",
  333. "execution_count": 22,
  334. "metadata": {
  335. "collapsed": false
  336. },
  337. "outputs": [],
  338. "source": [
  339. "from sklearn.cluster import KMeans\n",
  340. "from sklearn import preprocessing\n",
  341. "\n",
  342. "train = score_df[pd.notnull(score_df['score'])].values\n",
  343. "train = preprocessing.scale(train)\n",
  344. "kmeans_model = KMeans(n_clusters=num_levels, random_state=1).fit(train)"
  345. ]
  346. },
  347. {
  348. "cell_type": "code",
  349. "execution_count": 23,
  350. "metadata": {
  351. "collapsed": false
  352. },
  353. "outputs": [],
  354. "source": [
  355. "score_df['level'] = kmeans_model.labels_"
  356. ]
  357. },
  358. {
  359. "cell_type": "code",
  360. "execution_count": 24,
  361. "metadata": {
  362. "collapsed": false
  363. },
  364. "outputs": [],
  365. "source": [
  366. "score_levels = {}\n",
  367. "for level in range(num_levels):\n",
  368. " score_levels[level] = score_df[score_df['level'] == level]['score'].mean()\n",
  369. "\n",
  370. "levels = sorted(score_levels.items(), key=operator.itemgetter(1), reverse=True)"
  371. ]
  372. },
  373. {
  374. "cell_type": "code",
  375. "execution_count": 25,
  376. "metadata": {
  377. "collapsed": false
  378. },
  379. "outputs": [],
  380. "source": [
  381. "global_tag_list = [score_df[score_df['level']==levels[level][0]].index.tolist() for level in range(num_levels)]"
  382. ]
  383. },
  384. {
  385. "cell_type": "markdown",
  386. "metadata": {},
  387. "source": [
  388. "### Tag levels"
  389. ]
  390. },
  391. {
  392. "cell_type": "code",
  393. "execution_count": 26,
  394. "metadata": {
  395. "collapsed": false
  396. },
  397. "outputs": [
  398. {
  399. "name": "stdout",
  400. "output_type": "stream",
  401. "text": [
  402. "Level 1: ['Audience Strategy']\n",
  403. "Level 2: ['Ad Type', 'Ad Format']\n",
  404. "Level 3: ['Publisher Platforms', 'Campaign Objective', 'Audience Types', 'Facebook Positions']\n",
  405. "Level 4: ['Landing Pages', 'Age Range', 'Interests', 'Custom Audiences']\n"
  406. ]
  407. }
  408. ],
  409. "source": [
  410. "for level in range(num_levels):\n",
  411. " print('Level {0}:'.format(level + 1) , global_tag_list[level])"
  412. ]
  413. },
  414. {
  415. "cell_type": "code",
  416. "execution_count": 27,
  417. "metadata": {
  418. "collapsed": true
  419. },
  420. "outputs": [],
  421. "source": [
  422. "# global_tag_list = ['Campaign Objective']"
  423. ]
  424. },
  425. {
  426. "cell_type": "code",
  427. "execution_count": 28,
  428. "metadata": {
  429. "collapsed": true
  430. },
  431. "outputs": [],
  432. "source": [
  433. "aggregations = {'fb_spend': pd.np.sum,\n",
  434. " 'ga_transactions': pd.np.sum,\n",
  435. " 'ga_revenue': pd.np.sum,\n",
  436. " }"
  437. ]
  438. },
  439. {
  440. "cell_type": "code",
  441. "execution_count": 29,
  442. "metadata": {
  443. "collapsed": false
  444. },
  445. "outputs": [],
  446. "source": [
  447. "overall = df_global['fb_spend'].sum() / df_global['ga_transactions'].sum()"
  448. ]
  449. },
  450. {
  451. "cell_type": "code",
  452. "execution_count": 30,
  453. "metadata": {
  454. "collapsed": false
  455. },
  456. "outputs": [],
  457. "source": [
  458. "df_global['ga_cpt'] = df_global['fb_spend'] / df_global['ga_transactions']\n",
  459. "df_global.replace([pd.np.inf, -pd.np.inf, float('inf')], 0, inplace=True)"
  460. ]
  461. },
  462. {
  463. "cell_type": "code",
  464. "execution_count": 31,
  465. "metadata": {
  466. "collapsed": true
  467. },
  468. "outputs": [],
  469. "source": [
  470. "overall_dev = df_global.ga_cpt.std()"
  471. ]
  472. },
  473. {
  474. "cell_type": "code",
  475. "execution_count": 32,
  476. "metadata": {
  477. "collapsed": false
  478. },
  479. "outputs": [],
  480. "source": [
  481. "P = pd.np.percentile(df_global.fb_spend, [10, 100])"
  482. ]
  483. },
  484. {
  485. "cell_type": "code",
  486. "execution_count": 33,
  487. "metadata": {
  488. "collapsed": false
  489. },
  490. "outputs": [],
  491. "source": [
  492. "df_global_true = df_global.copy()"
  493. ]
  494. },
  495. {
  496. "cell_type": "code",
  497. "execution_count": 34,
  498. "metadata": {
  499. "collapsed": true
  500. },
  501. "outputs": [],
  502. "source": [
  503. "df_global = df_global#[(df_global.fb_spend >= P[0]) & (df_global.fb_spend <= P[1])]"
  504. ]
  505. },
  506. {
  507. "cell_type": "code",
  508. "execution_count": 35,
  509. "metadata": {
  510. "collapsed": true
  511. },
  512. "outputs": [],
  513. "source": [
  514. "df_global = df_global[df_global.ga_cpt > 0]"
  515. ]
  516. },
  517. {
  518. "cell_type": "code",
  519. "execution_count": 44,
  520. "metadata": {
  521. "collapsed": false
  522. },
  523. "outputs": [],
  524. "source": [
  525. "def process_paths(df, tag_list_obj):\n",
  526. " \n",
  527. " \n",
  528. " def recurse_paths(tag_list, tag_list_old, tag_values_old):\n",
  529. " if len(tag_list):\n",
  530. " tag_level = tag_list.pop(0)\n",
  531. "\n",
  532. " tags = []\n",
  533. " if isinstance(tag_level, list):\n",
  534. " tags = tags + tag_level\n",
  535. " else:\n",
  536. " tags = tags + [tag_level]\n",
  537. " \n",
  538. " if len(tag_list_old):\n",
  539. " old = df.groupby(tag_list_old).agg(aggregations)\n",
  540. " old['ga_cpt'] = old['fb_spend'] / old['ga_transactions']\n",
  541. " old_cpt = old.loc[tag_values_old]['ga_cpt']\n",
  542. " old_spend = old.loc[tag_values_old]['fb_spend']\n",
  543. " else:\n",
  544. " old = df\n",
  545. " old_cpt = old.fb_spend.sum() / old.ga_transactions.sum()\n",
  546. " old_spend = old.fb_spend.sum()\n",
  547. "\n",
  548. " premature = True\n",
  549. " for tag in tags:\n",
  550. " new_tag_list = tag_list_old + [tag]\n",
  551. "\n",
  552. " new = df.groupby(new_tag_list).agg(aggregations)\n",
  553. " new['ga_cpt'] = new['fb_spend'] / new['ga_transactions']\n",
  554. " prop = new['fb_spend'] / old_spend\n",
  555. " \n",
  556. " if pd.np.max(prop) > 0.95:\n",
  557. " continue\n",
  558. " \n",
  559. " tag_values = set([val[-1] if isinstance(val, tuple) else val for val in new.index.values.tolist()] )\n",
  560. "\n",
  561. " if (tag_values == ['None']):\n",
  562. " continue\n",
  563. "\n",
  564. " for value in tag_values:\n",
  565. " if value == 'None':\n",
  566. " continue\n",
  567. " new_tag_value = tag_values_old + (value,)\n",
  568. " try:\n",
  569. " new.loc[new_tag_value]\n",
  570. " except:\n",
  571. " continue\n",
  572. " if True:#(new.loc[new_tag_value].fb_spend >= P[0]) & (new.loc[new_tag_value].fb_spend <= P[1]):\n",
  573. " value_df = new.loc[new_tag_value]\n",
  574. " bad_condition = (((value_df.fb_spend / value_df.ga_transactions) - old_cpt) / old_cpt ) > 0.2\n",
  575. " good_condition = (((value_df.fb_spend / value_df.ga_transactions) - old_cpt) / old_cpt )< -0.2\n",
  576. " if bad_condition:\n",
  577. " bad[new_tag_value] = {'cpt': value_df.fb_spend / value_df.ga_transactions,\n",
  578. " 'spend_prop': value_df.fb_spend*100 / df_global.fb_spend.sum(),\n",
  579. " 'tag_list': new_tag_list}\n",
  580. " \n",
  581. " if good_condition:\n",
  582. " good[new_tag_value] = {'cpt': value_df.fb_spend / value_df.ga_transactions,\n",
  583. " 'spend_prop': value_df.fb_spend*100 / df_global.fb_spend.sum(),\n",
  584. " 'tag_list': new_tag_list} \n",
  585. " \n",
  586. " premature = False\n",
  587. " recurse_paths(tag_list[:], new_tag_list[:], new_tag_value[:])\n",
  588. " \n",
  589. " if premature and len(tag_list):\n",
  590. " recurse_paths(tag_list[:], tag_list_old, tag_values_old)\n",
  591. " \n",
  592. " recurse_paths(tag_list_obj, [], ())"
  593. ]
  594. },
  595. {
  596. "cell_type": "code",
  597. "execution_count": 45,
  598. "metadata": {
  599. "collapsed": true
  600. },
  601. "outputs": [],
  602. "source": [
  603. "bad = {}\n",
  604. "good = {}"
  605. ]
  606. },
  607. {
  608. "cell_type": "code",
  609. "execution_count": 46,
  610. "metadata": {
  611. "collapsed": false
  612. },
  613. "outputs": [],
  614. "source": [
  615. "tag_list = global_tag_list\n",
  616. "process_paths(df_global, tag_list[:])\n",
  617. "bad_raw = bad.copy()\n",
  618. "good_raw = good.copy()"
  619. ]
  620. },
  621. {
  622. "cell_type": "code",
  623. "execution_count": 49,
  624. "metadata": {
  625. "collapsed": false
  626. },
  627. "outputs": [],
  628. "source": [
  629. "def get_filtered_paths(paths):\n",
  630. " filtered_paths = {key: value for (key, value) in paths.items() if value['spend_prop'] > 2}\n",
  631. "\n",
  632. " processed_paths = {}\n",
  633. " for key, value in filtered_paths.items():\n",
  634. " l = list(key)\n",
  635. " none_list = ['-']*len(tag_list)\n",
  636. " none_list[:len(l)] = l\n",
  637. " if len(none_list) > 1:\n",
  638. " new_key = tuple(none_list)\n",
  639. " else:\n",
  640. " new_key = none_list[0]\n",
  641. "\n",
  642. " if tuple(value['tag_list']) in processed_paths:\n",
  643. " processed_paths[tuple(value['tag_list'])][new_key] = {metric: val for metric, val in value.items() if metric != 'tag_list'}\n",
  644. " else:\n",
  645. " processed_paths[tuple(value['tag_list'])] = {}\n",
  646. " processed_paths[tuple(value['tag_list'])][new_key] = {metric: val for metric, val in value.items() if metric != 'tag_list'}\n",
  647. "\n",
  648. " impact_values = {}\n",
  649. " for key, value in processed_paths.items():\n",
  650. " out_df = pd.DataFrame().from_dict(value, orient='index')\n",
  651. " impact = out_df.cpt.mean()*out_df.spend_prop.mean()\n",
  652. " impact_values[key] = impact\n",
  653. "\n",
  654. " impacts = sorted(impact_values.items(), key=operator.itemgetter(1), reverse=True)\n",
  655. " \n",
  656. " return processed_paths, impacts"
  657. ]
  658. },
  659. {
  660. "cell_type": "markdown",
  661. "metadata": {},
  662. "source": [
  663. "### Bad paths"
  664. ]
  665. },
  666. {
  667. "cell_type": "code",
  668. "execution_count": 50,
  669. "metadata": {
  670. "collapsed": false,
  671. "scrolled": false
  672. },
  673. "outputs": [
  674. {
  675. "data": {
  676. "text/html": [
  677. "<div>\n",
  678. "<table border=\"1\" class=\"dataframe\">\n",
  679. " <thead>\n",
  680. " <tr style=\"text-align: right;\">\n",
  681. " <th></th>\n",
  682. " <th></th>\n",
  683. " <th></th>\n",
  684. " <th></th>\n",
  685. " <th>spend_prop</th>\n",
  686. " <th>cpt</th>\n",
  687. " </tr>\n",
  688. " <tr>\n",
  689. " <th>Audience Strategy</th>\n",
  690. " <th>Ad Type</th>\n",
  691. " <th>Publisher Platforms</th>\n",
  692. " <th>Landing Pages</th>\n",
  693. " <th></th>\n",
  694. " <th></th>\n",
  695. " </tr>\n",
  696. " </thead>\n",
  697. " <tbody>\n",
  698. " <tr>\n",
  699. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  700. " <th rowspan=\"3\" valign=\"top\">Carousel</th>\n",
  701. " <th rowspan=\"3\" valign=\"top\">facebook</th>\n",
  702. " <th>www.zivame.com</th>\n",
  703. " <td>3.055746</td>\n",
  704. " <td>1438.573941</td>\n",
  705. " </tr>\n",
  706. " <tr>\n",
  707. " <th>www.zivame.com/no-sag-flat-30.html</th>\n",
  708. " <td>2.256079</td>\n",
  709. " <td>1507.750070</td>\n",
  710. " </tr>\n",
  711. " <tr>\n",
  712. " <th>www.zivame.com/nov-buy-1-get-1-free.html</th>\n",
  713. " <td>2.062589</td>\n",
  714. " <td>1350.115411</td>\n",
  715. " </tr>\n",
  716. " </tbody>\n",
  717. "</table>\n",
  718. "</div>"
  719. ],
  720. "text/plain": [
  721. " spend_prop \\\n",
  722. "Audience Strategy Ad Type Publisher Platforms Landing Pages \n",
  723. "Retention Carousel facebook www.zivame.com 3.055746 \n",
  724. " www.zivame.com/no-sag-flat-30.html 2.256079 \n",
  725. " www.zivame.com/nov-buy-1-get-1-free.html 2.062589 \n",
  726. "\n",
  727. " cpt \n",
  728. "Audience Strategy Ad Type Publisher Platforms Landing Pages \n",
  729. "Retention Carousel facebook www.zivame.com 1438.573941 \n",
  730. " www.zivame.com/no-sag-flat-30.html 1507.750070 \n",
  731. " www.zivame.com/nov-buy-1-get-1-free.html 1350.115411 "
  732. ]
  733. },
  734. "metadata": {},
  735. "output_type": "display_data"
  736. },
  737. {
  738. "data": {
  739. "text/html": [
  740. "<div>\n",
  741. "<table border=\"1\" class=\"dataframe\">\n",
  742. " <thead>\n",
  743. " <tr style=\"text-align: right;\">\n",
  744. " <th></th>\n",
  745. " <th></th>\n",
  746. " <th></th>\n",
  747. " <th></th>\n",
  748. " <th>spend_prop</th>\n",
  749. " <th>cpt</th>\n",
  750. " </tr>\n",
  751. " <tr>\n",
  752. " <th>Audience Strategy</th>\n",
  753. " <th>Ad Type</th>\n",
  754. " <th>Audience Types</th>\n",
  755. " <th>Custom Audiences</th>\n",
  756. " <th></th>\n",
  757. " <th></th>\n",
  758. " </tr>\n",
  759. " </thead>\n",
  760. " <tbody>\n",
  761. " <tr>\n",
  762. " <th>Retention</th>\n",
  763. " <th>Carousel</th>\n",
  764. " <th>Custom</th>\n",
  765. " <th>shapewear buyers</th>\n",
  766. " <td>2.975907</td>\n",
  767. " <td>1597.755618</td>\n",
  768. " </tr>\n",
  769. " </tbody>\n",
  770. "</table>\n",
  771. "</div>"
  772. ],
  773. "text/plain": [
  774. " spend_prop \\\n",
  775. "Audience Strategy Ad Type Audience Types Custom Audiences \n",
  776. "Retention Carousel Custom shapewear buyers 2.975907 \n",
  777. "\n",
  778. " cpt \n",
  779. "Audience Strategy Ad Type Audience Types Custom Audiences \n",
  780. "Retention Carousel Custom shapewear buyers 1597.755618 "
  781. ]
  782. },
  783. "metadata": {},
  784. "output_type": "display_data"
  785. },
  786. {
  787. "data": {
  788. "text/html": [
  789. "<div>\n",
  790. "<table border=\"1\" class=\"dataframe\">\n",
  791. " <thead>\n",
  792. " <tr style=\"text-align: right;\">\n",
  793. " <th></th>\n",
  794. " <th></th>\n",
  795. " <th></th>\n",
  796. " <th></th>\n",
  797. " <th>spend_prop</th>\n",
  798. " <th>cpt</th>\n",
  799. " </tr>\n",
  800. " <tr>\n",
  801. " <th>Audience Strategy</th>\n",
  802. " <th>Ad Format</th>\n",
  803. " <th>Facebook Positions</th>\n",
  804. " <th>Age Range</th>\n",
  805. " <th></th>\n",
  806. " <th></th>\n",
  807. " </tr>\n",
  808. " </thead>\n",
  809. " <tbody>\n",
  810. " <tr>\n",
  811. " <th>Retention</th>\n",
  812. " <th>Image</th>\n",
  813. " <th>feed</th>\n",
  814. " <th>23-54</th>\n",
  815. " <td>2.791431</td>\n",
  816. " <td>1240.793349</td>\n",
  817. " </tr>\n",
  818. " </tbody>\n",
  819. "</table>\n",
  820. "</div>"
  821. ],
  822. "text/plain": [
  823. " spend_prop \\\n",
  824. "Audience Strategy Ad Format Facebook Positions Age Range \n",
  825. "Retention Image feed 23-54 2.791431 \n",
  826. "\n",
  827. " cpt \n",
  828. "Audience Strategy Ad Format Facebook Positions Age Range \n",
  829. "Retention Image feed 23-54 1240.793349 "
  830. ]
  831. },
  832. "metadata": {},
  833. "output_type": "display_data"
  834. },
  835. {
  836. "data": {
  837. "text/html": [
  838. "<div>\n",
  839. "<table border=\"1\" class=\"dataframe\">\n",
  840. " <thead>\n",
  841. " <tr style=\"text-align: right;\">\n",
  842. " <th></th>\n",
  843. " <th></th>\n",
  844. " <th></th>\n",
  845. " <th></th>\n",
  846. " <th>spend_prop</th>\n",
  847. " <th>cpt</th>\n",
  848. " </tr>\n",
  849. " <tr>\n",
  850. " <th>Audience Strategy</th>\n",
  851. " <th>Ad Format</th>\n",
  852. " <th>Publisher Platforms</th>\n",
  853. " <th>Age Range</th>\n",
  854. " <th></th>\n",
  855. " <th></th>\n",
  856. " </tr>\n",
  857. " </thead>\n",
  858. " <tbody>\n",
  859. " <tr>\n",
  860. " <th>Retention</th>\n",
  861. " <th>Image</th>\n",
  862. " <th>facebook</th>\n",
  863. " <th>23-54</th>\n",
  864. " <td>2.791431</td>\n",
  865. " <td>1240.793349</td>\n",
  866. " </tr>\n",
  867. " </tbody>\n",
  868. "</table>\n",
  869. "</div>"
  870. ],
  871. "text/plain": [
  872. " spend_prop \\\n",
  873. "Audience Strategy Ad Format Publisher Platforms Age Range \n",
  874. "Retention Image facebook 23-54 2.791431 \n",
  875. "\n",
  876. " cpt \n",
  877. "Audience Strategy Ad Format Publisher Platforms Age Range \n",
  878. "Retention Image facebook 23-54 1240.793349 "
  879. ]
  880. },
  881. "metadata": {},
  882. "output_type": "display_data"
  883. },
  884. {
  885. "data": {
  886. "text/html": [
  887. "<div>\n",
  888. "<table border=\"1\" class=\"dataframe\">\n",
  889. " <thead>\n",
  890. " <tr style=\"text-align: right;\">\n",
  891. " <th></th>\n",
  892. " <th></th>\n",
  893. " <th></th>\n",
  894. " <th></th>\n",
  895. " <th>spend_prop</th>\n",
  896. " <th>cpt</th>\n",
  897. " </tr>\n",
  898. " <tr>\n",
  899. " <th>Audience Strategy</th>\n",
  900. " <th>Ad Type</th>\n",
  901. " <th>Publisher Platforms</th>\n",
  902. " <th>Age Range</th>\n",
  903. " <th></th>\n",
  904. " <th></th>\n",
  905. " </tr>\n",
  906. " </thead>\n",
  907. " <tbody>\n",
  908. " <tr>\n",
  909. " <th>Retention</th>\n",
  910. " <th>Carousel</th>\n",
  911. " <th>facebook</th>\n",
  912. " <th>23-54</th>\n",
  913. " <td>2.839474</td>\n",
  914. " <td>1250.515714</td>\n",
  915. " </tr>\n",
  916. " </tbody>\n",
  917. "</table>\n",
  918. "</div>"
  919. ],
  920. "text/plain": [
  921. " spend_prop \\\n",
  922. "Audience Strategy Ad Type Publisher Platforms Age Range \n",
  923. "Retention Carousel facebook 23-54 2.839474 \n",
  924. "\n",
  925. " cpt \n",
  926. "Audience Strategy Ad Type Publisher Platforms Age Range \n",
  927. "Retention Carousel facebook 23-54 1250.515714 "
  928. ]
  929. },
  930. "metadata": {},
  931. "output_type": "display_data"
  932. },
  933. {
  934. "data": {
  935. "text/html": [
  936. "<div>\n",
  937. "<table border=\"1\" class=\"dataframe\">\n",
  938. " <thead>\n",
  939. " <tr style=\"text-align: right;\">\n",
  940. " <th></th>\n",
  941. " <th></th>\n",
  942. " <th></th>\n",
  943. " <th></th>\n",
  944. " <th>spend_prop</th>\n",
  945. " <th>cpt</th>\n",
  946. " </tr>\n",
  947. " <tr>\n",
  948. " <th>Audience Strategy</th>\n",
  949. " <th>Ad Type</th>\n",
  950. " <th>Facebook Positions</th>\n",
  951. " <th>Custom Audiences</th>\n",
  952. " <th></th>\n",
  953. " <th></th>\n",
  954. " </tr>\n",
  955. " </thead>\n",
  956. " <tbody>\n",
  957. " <tr>\n",
  958. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  959. " <th rowspan=\"3\" valign=\"top\">Carousel</th>\n",
  960. " <th rowspan=\"3\" valign=\"top\">feed</th>\n",
  961. " <th>Rem_AllBrasExclPadded_30_2</th>\n",
  962. " <td>3.341379</td>\n",
  963. " <td>1252.265843</td>\n",
  964. " </tr>\n",
  965. " <tr>\n",
  966. " <th>avg value 500-1000</th>\n",
  967. " <td>3.206305</td>\n",
  968. " <td>1292.907553</td>\n",
  969. " </tr>\n",
  970. " <tr>\n",
  971. " <th>shapewear buyers</th>\n",
  972. " <td>2.975907</td>\n",
  973. " <td>1597.755618</td>\n",
  974. " </tr>\n",
  975. " </tbody>\n",
  976. "</table>\n",
  977. "</div>"
  978. ],
  979. "text/plain": [
  980. " spend_prop \\\n",
  981. "Audience Strategy Ad Type Facebook Positions Custom Audiences \n",
  982. "Retention Carousel feed Rem_AllBrasExclPadded_30_2 3.341379 \n",
  983. " avg value 500-1000 3.206305 \n",
  984. " shapewear buyers 2.975907 \n",
  985. "\n",
  986. " cpt \n",
  987. "Audience Strategy Ad Type Facebook Positions Custom Audiences \n",
  988. "Retention Carousel feed Rem_AllBrasExclPadded_30_2 1252.265843 \n",
  989. " avg value 500-1000 1292.907553 \n",
  990. " shapewear buyers 1597.755618 "
  991. ]
  992. },
  993. "metadata": {},
  994. "output_type": "display_data"
  995. },
  996. {
  997. "data": {
  998. "text/html": [
  999. "<div>\n",
  1000. "<table border=\"1\" class=\"dataframe\">\n",
  1001. " <thead>\n",
  1002. " <tr style=\"text-align: right;\">\n",
  1003. " <th></th>\n",
  1004. " <th></th>\n",
  1005. " <th></th>\n",
  1006. " <th></th>\n",
  1007. " <th>spend_prop</th>\n",
  1008. " <th>cpt</th>\n",
  1009. " </tr>\n",
  1010. " <tr>\n",
  1011. " <th>Audience Strategy</th>\n",
  1012. " <th>Ad Format</th>\n",
  1013. " <th>Facebook Positions</th>\n",
  1014. " <th>Landing Pages</th>\n",
  1015. " <th></th>\n",
  1016. " <th></th>\n",
  1017. " </tr>\n",
  1018. " </thead>\n",
  1019. " <tbody>\n",
  1020. " <tr>\n",
  1021. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1022. " <th rowspan=\"3\" valign=\"top\">Image</th>\n",
  1023. " <th rowspan=\"3\" valign=\"top\">feed</th>\n",
  1024. " <th>www.zivame.com</th>\n",
  1025. " <td>2.833776</td>\n",
  1026. " <td>1417.892251</td>\n",
  1027. " </tr>\n",
  1028. " <tr>\n",
  1029. " <th>www.zivame.com/no-sag-flat-30.html</th>\n",
  1030. " <td>2.256079</td>\n",
  1031. " <td>1507.750070</td>\n",
  1032. " </tr>\n",
  1033. " <tr>\n",
  1034. " <th>www.zivame.com/nov-buy-1-get-1-free.html</th>\n",
  1035. " <td>2.062589</td>\n",
  1036. " <td>1350.115411</td>\n",
  1037. " </tr>\n",
  1038. " </tbody>\n",
  1039. "</table>\n",
  1040. "</div>"
  1041. ],
  1042. "text/plain": [
  1043. " spend_prop \\\n",
  1044. "Audience Strategy Ad Format Facebook Positions Landing Pages \n",
  1045. "Retention Image feed www.zivame.com 2.833776 \n",
  1046. " www.zivame.com/no-sag-flat-30.html 2.256079 \n",
  1047. " www.zivame.com/nov-buy-1-get-1-free.html 2.062589 \n",
  1048. "\n",
  1049. " cpt \n",
  1050. "Audience Strategy Ad Format Facebook Positions Landing Pages \n",
  1051. "Retention Image feed www.zivame.com 1417.892251 \n",
  1052. " www.zivame.com/no-sag-flat-30.html 1507.750070 \n",
  1053. " www.zivame.com/nov-buy-1-get-1-free.html 1350.115411 "
  1054. ]
  1055. },
  1056. "metadata": {},
  1057. "output_type": "display_data"
  1058. },
  1059. {
  1060. "data": {
  1061. "text/html": [
  1062. "<div>\n",
  1063. "<table border=\"1\" class=\"dataframe\">\n",
  1064. " <thead>\n",
  1065. " <tr style=\"text-align: right;\">\n",
  1066. " <th></th>\n",
  1067. " <th></th>\n",
  1068. " <th></th>\n",
  1069. " <th></th>\n",
  1070. " <th>spend_prop</th>\n",
  1071. " <th>cpt</th>\n",
  1072. " </tr>\n",
  1073. " <tr>\n",
  1074. " <th>Audience Strategy</th>\n",
  1075. " <th>Ad Format</th>\n",
  1076. " <th>Publisher Platforms</th>\n",
  1077. " <th>Landing Pages</th>\n",
  1078. " <th></th>\n",
  1079. " <th></th>\n",
  1080. " </tr>\n",
  1081. " </thead>\n",
  1082. " <tbody>\n",
  1083. " <tr>\n",
  1084. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1085. " <th rowspan=\"3\" valign=\"top\">Image</th>\n",
  1086. " <th rowspan=\"3\" valign=\"top\">facebook</th>\n",
  1087. " <th>www.zivame.com</th>\n",
  1088. " <td>2.833776</td>\n",
  1089. " <td>1417.892251</td>\n",
  1090. " </tr>\n",
  1091. " <tr>\n",
  1092. " <th>www.zivame.com/no-sag-flat-30.html</th>\n",
  1093. " <td>2.256079</td>\n",
  1094. " <td>1507.750070</td>\n",
  1095. " </tr>\n",
  1096. " <tr>\n",
  1097. " <th>www.zivame.com/nov-buy-1-get-1-free.html</th>\n",
  1098. " <td>2.062589</td>\n",
  1099. " <td>1350.115411</td>\n",
  1100. " </tr>\n",
  1101. " </tbody>\n",
  1102. "</table>\n",
  1103. "</div>"
  1104. ],
  1105. "text/plain": [
  1106. " spend_prop \\\n",
  1107. "Audience Strategy Ad Format Publisher Platforms Landing Pages \n",
  1108. "Retention Image facebook www.zivame.com 2.833776 \n",
  1109. " www.zivame.com/no-sag-flat-30.html 2.256079 \n",
  1110. " www.zivame.com/nov-buy-1-get-1-free.html 2.062589 \n",
  1111. "\n",
  1112. " cpt \n",
  1113. "Audience Strategy Ad Format Publisher Platforms Landing Pages \n",
  1114. "Retention Image facebook www.zivame.com 1417.892251 \n",
  1115. " www.zivame.com/no-sag-flat-30.html 1507.750070 \n",
  1116. " www.zivame.com/nov-buy-1-get-1-free.html 1350.115411 "
  1117. ]
  1118. },
  1119. "metadata": {},
  1120. "output_type": "display_data"
  1121. },
  1122. {
  1123. "data": {
  1124. "text/html": [
  1125. "<div>\n",
  1126. "<table border=\"1\" class=\"dataframe\">\n",
  1127. " <thead>\n",
  1128. " <tr style=\"text-align: right;\">\n",
  1129. " <th></th>\n",
  1130. " <th></th>\n",
  1131. " <th></th>\n",
  1132. " <th></th>\n",
  1133. " <th>spend_prop</th>\n",
  1134. " <th>cpt</th>\n",
  1135. " </tr>\n",
  1136. " <tr>\n",
  1137. " <th>Audience Strategy</th>\n",
  1138. " <th>Ad Type</th>\n",
  1139. " <th>Audience Types</th>\n",
  1140. " <th>Landing Pages</th>\n",
  1141. " <th></th>\n",
  1142. " <th></th>\n",
  1143. " </tr>\n",
  1144. " </thead>\n",
  1145. " <tbody>\n",
  1146. " <tr>\n",
  1147. " <th>Retention</th>\n",
  1148. " <th>Carousel</th>\n",
  1149. " <th>Custom</th>\n",
  1150. " <th>www.zivame.com</th>\n",
  1151. " <td>2.032741</td>\n",
  1152. " <td>1438.995407</td>\n",
  1153. " </tr>\n",
  1154. " </tbody>\n",
  1155. "</table>\n",
  1156. "</div>"
  1157. ],
  1158. "text/plain": [
  1159. " spend_prop \\\n",
  1160. "Audience Strategy Ad Type Audience Types Landing Pages \n",
  1161. "Retention Carousel Custom www.zivame.com 2.032741 \n",
  1162. "\n",
  1163. " cpt \n",
  1164. "Audience Strategy Ad Type Audience Types Landing Pages \n",
  1165. "Retention Carousel Custom www.zivame.com 1438.995407 "
  1166. ]
  1167. },
  1168. "metadata": {},
  1169. "output_type": "display_data"
  1170. },
  1171. {
  1172. "data": {
  1173. "text/html": [
  1174. "<div>\n",
  1175. "<table border=\"1\" class=\"dataframe\">\n",
  1176. " <thead>\n",
  1177. " <tr style=\"text-align: right;\">\n",
  1178. " <th></th>\n",
  1179. " <th></th>\n",
  1180. " <th></th>\n",
  1181. " <th></th>\n",
  1182. " <th>spend_prop</th>\n",
  1183. " <th>cpt</th>\n",
  1184. " </tr>\n",
  1185. " <tr>\n",
  1186. " <th>Audience Strategy</th>\n",
  1187. " <th>Ad Format</th>\n",
  1188. " <th>Facebook Positions</th>\n",
  1189. " <th>Custom Audiences</th>\n",
  1190. " <th></th>\n",
  1191. " <th></th>\n",
  1192. " </tr>\n",
  1193. " </thead>\n",
  1194. " <tbody>\n",
  1195. " <tr>\n",
  1196. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1197. " <th rowspan=\"3\" valign=\"top\">Image</th>\n",
  1198. " <th rowspan=\"3\" valign=\"top\">feed</th>\n",
  1199. " <th>Rem_AllBrasExclPadded_30_2</th>\n",
  1200. " <td>3.314888</td>\n",
  1201. " <td>1252.158577</td>\n",
  1202. " </tr>\n",
  1203. " <tr>\n",
  1204. " <th>avg value 500-1000</th>\n",
  1205. " <td>3.206305</td>\n",
  1206. " <td>1292.907553</td>\n",
  1207. " </tr>\n",
  1208. " <tr>\n",
  1209. " <th>shapewear buyers</th>\n",
  1210. " <td>2.975907</td>\n",
  1211. " <td>1597.755618</td>\n",
  1212. " </tr>\n",
  1213. " </tbody>\n",
  1214. "</table>\n",
  1215. "</div>"
  1216. ],
  1217. "text/plain": [
  1218. " spend_prop \\\n",
  1219. "Audience Strategy Ad Format Facebook Positions Custom Audiences \n",
  1220. "Retention Image feed Rem_AllBrasExclPadded_30_2 3.314888 \n",
  1221. " avg value 500-1000 3.206305 \n",
  1222. " shapewear buyers 2.975907 \n",
  1223. "\n",
  1224. " cpt \n",
  1225. "Audience Strategy Ad Format Facebook Positions Custom Audiences \n",
  1226. "Retention Image feed Rem_AllBrasExclPadded_30_2 1252.158577 \n",
  1227. " avg value 500-1000 1292.907553 \n",
  1228. " shapewear buyers 1597.755618 "
  1229. ]
  1230. },
  1231. "metadata": {},
  1232. "output_type": "display_data"
  1233. },
  1234. {
  1235. "data": {
  1236. "text/html": [
  1237. "<div>\n",
  1238. "<table border=\"1\" class=\"dataframe\">\n",
  1239. " <thead>\n",
  1240. " <tr style=\"text-align: right;\">\n",
  1241. " <th></th>\n",
  1242. " <th></th>\n",
  1243. " <th></th>\n",
  1244. " <th></th>\n",
  1245. " <th>spend_prop</th>\n",
  1246. " <th>cpt</th>\n",
  1247. " </tr>\n",
  1248. " <tr>\n",
  1249. " <th>Audience Strategy</th>\n",
  1250. " <th>Ad Format</th>\n",
  1251. " <th>Audience Types</th>\n",
  1252. " <th>-</th>\n",
  1253. " <th></th>\n",
  1254. " <th></th>\n",
  1255. " </tr>\n",
  1256. " </thead>\n",
  1257. " <tbody>\n",
  1258. " <tr>\n",
  1259. " <th>Retention</th>\n",
  1260. " <th>Image</th>\n",
  1261. " <th>Combination</th>\n",
  1262. " <th>-</th>\n",
  1263. " <td>6.163229</td>\n",
  1264. " <td>1272.15013</td>\n",
  1265. " </tr>\n",
  1266. " </tbody>\n",
  1267. "</table>\n",
  1268. "</div>"
  1269. ],
  1270. "text/plain": [
  1271. " spend_prop cpt\n",
  1272. "Audience Strategy Ad Format Audience Types - \n",
  1273. "Retention Image Combination - 6.163229 1272.15013"
  1274. ]
  1275. },
  1276. "metadata": {},
  1277. "output_type": "display_data"
  1278. },
  1279. {
  1280. "data": {
  1281. "text/html": [
  1282. "<div>\n",
  1283. "<table border=\"1\" class=\"dataframe\">\n",
  1284. " <thead>\n",
  1285. " <tr style=\"text-align: right;\">\n",
  1286. " <th></th>\n",
  1287. " <th></th>\n",
  1288. " <th></th>\n",
  1289. " <th></th>\n",
  1290. " <th>spend_prop</th>\n",
  1291. " <th>cpt</th>\n",
  1292. " </tr>\n",
  1293. " <tr>\n",
  1294. " <th>Audience Strategy</th>\n",
  1295. " <th>Ad Format</th>\n",
  1296. " <th>Publisher Platforms</th>\n",
  1297. " <th>Custom Audiences</th>\n",
  1298. " <th></th>\n",
  1299. " <th></th>\n",
  1300. " </tr>\n",
  1301. " </thead>\n",
  1302. " <tbody>\n",
  1303. " <tr>\n",
  1304. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1305. " <th rowspan=\"3\" valign=\"top\">Image</th>\n",
  1306. " <th rowspan=\"3\" valign=\"top\">facebook</th>\n",
  1307. " <th>Rem_AllBrasExclPadded_30_2</th>\n",
  1308. " <td>3.314888</td>\n",
  1309. " <td>1252.158577</td>\n",
  1310. " </tr>\n",
  1311. " <tr>\n",
  1312. " <th>avg value 500-1000</th>\n",
  1313. " <td>3.206305</td>\n",
  1314. " <td>1292.907553</td>\n",
  1315. " </tr>\n",
  1316. " <tr>\n",
  1317. " <th>shapewear buyers</th>\n",
  1318. " <td>2.975907</td>\n",
  1319. " <td>1597.755618</td>\n",
  1320. " </tr>\n",
  1321. " </tbody>\n",
  1322. "</table>\n",
  1323. "</div>"
  1324. ],
  1325. "text/plain": [
  1326. " spend_prop \\\n",
  1327. "Audience Strategy Ad Format Publisher Platforms Custom Audiences \n",
  1328. "Retention Image facebook Rem_AllBrasExclPadded_30_2 3.314888 \n",
  1329. " avg value 500-1000 3.206305 \n",
  1330. " shapewear buyers 2.975907 \n",
  1331. "\n",
  1332. " cpt \n",
  1333. "Audience Strategy Ad Format Publisher Platforms Custom Audiences \n",
  1334. "Retention Image facebook Rem_AllBrasExclPadded_30_2 1252.158577 \n",
  1335. " avg value 500-1000 1292.907553 \n",
  1336. " shapewear buyers 1597.755618 "
  1337. ]
  1338. },
  1339. "metadata": {},
  1340. "output_type": "display_data"
  1341. },
  1342. {
  1343. "data": {
  1344. "text/html": [
  1345. "<div>\n",
  1346. "<table border=\"1\" class=\"dataframe\">\n",
  1347. " <thead>\n",
  1348. " <tr style=\"text-align: right;\">\n",
  1349. " <th></th>\n",
  1350. " <th></th>\n",
  1351. " <th></th>\n",
  1352. " <th></th>\n",
  1353. " <th>spend_prop</th>\n",
  1354. " <th>cpt</th>\n",
  1355. " </tr>\n",
  1356. " <tr>\n",
  1357. " <th>Audience Strategy</th>\n",
  1358. " <th>Ad Type</th>\n",
  1359. " <th>Publisher Platforms</th>\n",
  1360. " <th>Custom Audiences</th>\n",
  1361. " <th></th>\n",
  1362. " <th></th>\n",
  1363. " </tr>\n",
  1364. " </thead>\n",
  1365. " <tbody>\n",
  1366. " <tr>\n",
  1367. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1368. " <th rowspan=\"3\" valign=\"top\">Carousel</th>\n",
  1369. " <th rowspan=\"3\" valign=\"top\">facebook</th>\n",
  1370. " <th>Rem_AllBrasExclPadded_30_2</th>\n",
  1371. " <td>3.341379</td>\n",
  1372. " <td>1252.265843</td>\n",
  1373. " </tr>\n",
  1374. " <tr>\n",
  1375. " <th>avg value 500-1000</th>\n",
  1376. " <td>3.206305</td>\n",
  1377. " <td>1292.907553</td>\n",
  1378. " </tr>\n",
  1379. " <tr>\n",
  1380. " <th>shapewear buyers</th>\n",
  1381. " <td>2.975907</td>\n",
  1382. " <td>1597.755618</td>\n",
  1383. " </tr>\n",
  1384. " </tbody>\n",
  1385. "</table>\n",
  1386. "</div>"
  1387. ],
  1388. "text/plain": [
  1389. " spend_prop \\\n",
  1390. "Audience Strategy Ad Type Publisher Platforms Custom Audiences \n",
  1391. "Retention Carousel facebook Rem_AllBrasExclPadded_30_2 3.341379 \n",
  1392. " avg value 500-1000 3.206305 \n",
  1393. " shapewear buyers 2.975907 \n",
  1394. "\n",
  1395. " cpt \n",
  1396. "Audience Strategy Ad Type Publisher Platforms Custom Audiences \n",
  1397. "Retention Carousel facebook Rem_AllBrasExclPadded_30_2 1252.265843 \n",
  1398. " avg value 500-1000 1292.907553 \n",
  1399. " shapewear buyers 1597.755618 "
  1400. ]
  1401. },
  1402. "metadata": {},
  1403. "output_type": "display_data"
  1404. },
  1405. {
  1406. "data": {
  1407. "text/html": [
  1408. "<div>\n",
  1409. "<table border=\"1\" class=\"dataframe\">\n",
  1410. " <thead>\n",
  1411. " <tr style=\"text-align: right;\">\n",
  1412. " <th></th>\n",
  1413. " <th></th>\n",
  1414. " <th></th>\n",
  1415. " <th></th>\n",
  1416. " <th>spend_prop</th>\n",
  1417. " <th>cpt</th>\n",
  1418. " </tr>\n",
  1419. " <tr>\n",
  1420. " <th>Audience Strategy</th>\n",
  1421. " <th>Ad Type</th>\n",
  1422. " <th>Facebook Positions</th>\n",
  1423. " <th>Age Range</th>\n",
  1424. " <th></th>\n",
  1425. " <th></th>\n",
  1426. " </tr>\n",
  1427. " </thead>\n",
  1428. " <tbody>\n",
  1429. " <tr>\n",
  1430. " <th>Retention</th>\n",
  1431. " <th>Carousel</th>\n",
  1432. " <th>feed</th>\n",
  1433. " <th>23-54</th>\n",
  1434. " <td>2.839474</td>\n",
  1435. " <td>1250.515714</td>\n",
  1436. " </tr>\n",
  1437. " </tbody>\n",
  1438. "</table>\n",
  1439. "</div>"
  1440. ],
  1441. "text/plain": [
  1442. " spend_prop \\\n",
  1443. "Audience Strategy Ad Type Facebook Positions Age Range \n",
  1444. "Retention Carousel feed 23-54 2.839474 \n",
  1445. "\n",
  1446. " cpt \n",
  1447. "Audience Strategy Ad Type Facebook Positions Age Range \n",
  1448. "Retention Carousel feed 23-54 1250.515714 "
  1449. ]
  1450. },
  1451. "metadata": {},
  1452. "output_type": "display_data"
  1453. },
  1454. {
  1455. "data": {
  1456. "text/html": [
  1457. "<div>\n",
  1458. "<table border=\"1\" class=\"dataframe\">\n",
  1459. " <thead>\n",
  1460. " <tr style=\"text-align: right;\">\n",
  1461. " <th></th>\n",
  1462. " <th></th>\n",
  1463. " <th></th>\n",
  1464. " <th></th>\n",
  1465. " <th>spend_prop</th>\n",
  1466. " <th>cpt</th>\n",
  1467. " </tr>\n",
  1468. " <tr>\n",
  1469. " <th>Audience Strategy</th>\n",
  1470. " <th>Ad Type</th>\n",
  1471. " <th>Facebook Positions</th>\n",
  1472. " <th>Landing Pages</th>\n",
  1473. " <th></th>\n",
  1474. " <th></th>\n",
  1475. " </tr>\n",
  1476. " </thead>\n",
  1477. " <tbody>\n",
  1478. " <tr>\n",
  1479. " <th rowspan=\"3\" valign=\"top\">Retention</th>\n",
  1480. " <th rowspan=\"3\" valign=\"top\">Carousel</th>\n",
  1481. " <th rowspan=\"3\" valign=\"top\">feed</th>\n",
  1482. " <th>www.zivame.com</th>\n",
  1483. " <td>3.055746</td>\n",
  1484. " <td>1438.573941</td>\n",
  1485. " </tr>\n",
  1486. " <tr>\n",
  1487. " <th>www.zivame.com/no-sag-flat-30.html</th>\n",
  1488. " <td>2.256079</td>\n",
  1489. " <td>1507.750070</td>\n",
  1490. " </tr>\n",
  1491. " <tr>\n",
  1492. " <th>www.zivame.com/nov-buy-1-get-1-free.html</th>\n",
  1493. " <td>2.062589</td>\n",
  1494. " <td>1350.115411</td>\n",
  1495. " </tr>\n",
  1496. " </tbody>\n",
  1497. "</table>\n",
  1498. "</div>"
  1499. ],
  1500. "text/plain": [
  1501. " spend_prop \\\n",
  1502. "Audience Strategy Ad Type Facebook Positions Landing Pages \n",
  1503. "Retention Carousel feed www.zivame.com 3.055746 \n",
  1504. " www.zivame.com/no-sag-flat-30.html 2.256079 \n",
  1505. " www.zivame.com/nov-buy-1-get-1-free.html 2.062589 \n",
  1506. "\n",
  1507. " cpt \n",
  1508. "Audience Strategy Ad Type Facebook Positions Landing Pages \n",
  1509. "Retention Carousel feed www.zivame.com 1438.573941 \n",
  1510. " www.zivame.com/no-sag-flat-30.html 1507.750070 \n",
  1511. " www.zivame.com/nov-buy-1-get-1-free.html 1350.115411 "
  1512. ]
  1513. },
  1514. "metadata": {},
  1515. "output_type": "display_data"
  1516. },
  1517. {
  1518. "data": {
  1519. "text/html": [
  1520. "<div>\n",
  1521. "<table border=\"1\" class=\"dataframe\">\n",
  1522. " <thead>\n",
  1523. " <tr style=\"text-align: right;\">\n",
  1524. " <th></th>\n",
  1525. " <th></th>\n",
  1526. " <th></th>\n",
  1527. " <th></th>\n",
  1528. " <th>spend_prop</th>\n",
  1529. " <th>cpt</th>\n",
  1530. " </tr>\n",
  1531. " <tr>\n",
  1532. " <th>Audience Strategy</th>\n",
  1533. " <th>Ad Type</th>\n",
  1534. " <th>Audience Types</th>\n",
  1535. " <th>-</th>\n",
  1536. " <th></th>\n",
  1537. " <th></th>\n",
  1538. " </tr>\n",
  1539. " </thead>\n",
  1540. " <tbody>\n",
  1541. " <tr>\n",
  1542. " <th>Retention</th>\n",
  1543. " <th>Carousel</th>\n",
  1544. " <th>Combination</th>\n",
  1545. " <th>-</th>\n",
  1546. " <td>6.18972</td>\n",
  1547. " <td>1272.122968</td>\n",
  1548. " </tr>\n",
  1549. " </tbody>\n",
  1550. "</table>\n",
  1551. "</div>"
  1552. ],
  1553. "text/plain": [
  1554. " spend_prop cpt\n",
  1555. "Audience Strategy Ad Type Audience Types - \n",
  1556. "Retention Carousel Combination - 6.18972 1272.122968"
  1557. ]
  1558. },
  1559. "metadata": {},
  1560. "output_type": "display_data"
  1561. },
  1562. {
  1563. "data": {
  1564. "text/html": [
  1565. "<div>\n",
  1566. "<table border=\"1\" class=\"dataframe\">\n",
  1567. " <thead>\n",
  1568. " <tr style=\"text-align: right;\">\n",
  1569. " <th></th>\n",
  1570. " <th></th>\n",
  1571. " <th></th>\n",
  1572. " <th></th>\n",
  1573. " <th>spend_prop</th>\n",
  1574. " <th>cpt</th>\n",
  1575. " </tr>\n",
  1576. " <tr>\n",
  1577. " <th>Audience Strategy</th>\n",
  1578. " <th>Ad Format</th>\n",
  1579. " <th>Audience Types</th>\n",
  1580. " <th>Custom Audiences</th>\n",
  1581. " <th></th>\n",
  1582. " <th></th>\n",
  1583. " </tr>\n",
  1584. " </thead>\n",
  1585. " <tbody>\n",
  1586. " <tr>\n",
  1587. " <th>Retention</th>\n",
  1588. " <th>Image</th>\n",
  1589. " <th>Custom</th>\n",
  1590. " <th>shapewear buyers</th>\n",
  1591. " <td>2.975907</td>\n",
  1592. " <td>1597.755618</td>\n",
  1593. " </tr>\n",
  1594. " </tbody>\n",
  1595. "</table>\n",
  1596. "</div>"
  1597. ],
  1598. "text/plain": [
  1599. " spend_prop \\\n",
  1600. "Audience Strategy Ad Format Audience Types Custom Audiences \n",
  1601. "Retention Image Custom shapewear buyers 2.975907 \n",
  1602. "\n",
  1603. " cpt \n",
  1604. "Audience Strategy Ad Format Audience Types Custom Audiences \n",
  1605. "Retention Image Custom shapewear buyers 1597.755618 "
  1606. ]
  1607. },
  1608. "metadata": {},
  1609. "output_type": "display_data"
  1610. }
  1611. ],
  1612. "source": [
  1613. "bad_new, bad_impacts = get_filtered_paths(bad_raw)\n",
  1614. "bad_impacts_list = [value[0] for value in bad_impacts]\n",
  1615. "for key, value in bad_new.items():\n",
  1616. " if key in bad_impacts_list[0:]:\n",
  1617. " b = pd.DataFrame().from_dict(value, orient='index')\n",
  1618. " none_list = ['-']*len(tag_list)\n",
  1619. " l = list(key)\n",
  1620. " none_list[:len(l)] = l\n",
  1621. "\n",
  1622. " b.index = b.index.set_names(none_list)\n",
  1623. "\n",
  1624. " display(b)\n",
  1625. " "
  1626. ]
  1627. },
  1628. {
  1629. "cell_type": "markdown",
  1630. "metadata": {},
  1631. "source": [
  1632. "### Good Paths"
  1633. ]
  1634. },
  1635. {
  1636. "cell_type": "code",
  1637. "execution_count": 51,
  1638. "metadata": {
  1639. "collapsed": false,
  1640. "scrolled": false
  1641. },
  1642. "outputs": [
  1643. {
  1644. "data": {
  1645. "text/html": [
  1646. "<div>\n",
  1647. "<table border=\"1\" class=\"dataframe\">\n",
  1648. " <thead>\n",
  1649. " <tr style=\"text-align: right;\">\n",
  1650. " <th></th>\n",
  1651. " <th></th>\n",
  1652. " <th></th>\n",
  1653. " <th></th>\n",
  1654. " <th>spend_prop</th>\n",
  1655. " <th>cpt</th>\n",
  1656. " </tr>\n",
  1657. " <tr>\n",
  1658. " <th>Audience Strategy</th>\n",
  1659. " <th>Ad Type</th>\n",
  1660. " <th>Publisher Platforms</th>\n",
  1661. " <th>Landing Pages</th>\n",
  1662. " <th></th>\n",
  1663. " <th></th>\n",
  1664. " </tr>\n",
  1665. " </thead>\n",
  1666. " <tbody>\n",
  1667. " <tr>\n",
  1668. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  1669. " <th rowspan=\"2\" valign=\"top\">Carousel</th>\n",
  1670. " <th rowspan=\"2\" valign=\"top\">facebook</th>\n",
  1671. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  1672. " <td>3.466346</td>\n",
  1673. " <td>610.074862</td>\n",
  1674. " </tr>\n",
  1675. " <tr>\n",
  1676. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  1677. " <td>3.481535</td>\n",
  1678. " <td>518.258879</td>\n",
  1679. " </tr>\n",
  1680. " </tbody>\n",
  1681. "</table>\n",
  1682. "</div>"
  1683. ],
  1684. "text/plain": [
  1685. " spend_prop \\\n",
  1686. "Audience Strategy Ad Type Publisher Platforms Landing Pages \n",
  1687. "Retention Carousel facebook www.zivame.com/holi-special-half-price.html 3.466346 \n",
  1688. " www.zivame.com/panties/tummy-tucker-shaping-pan... 3.481535 \n",
  1689. "\n",
  1690. " cpt \n",
  1691. "Audience Strategy Ad Type Publisher Platforms Landing Pages \n",
  1692. "Retention Carousel facebook www.zivame.com/holi-special-half-price.html 610.074862 \n",
  1693. " www.zivame.com/panties/tummy-tucker-shaping-pan... 518.258879 "
  1694. ]
  1695. },
  1696. "metadata": {},
  1697. "output_type": "display_data"
  1698. },
  1699. {
  1700. "data": {
  1701. "text/html": [
  1702. "<div>\n",
  1703. "<table border=\"1\" class=\"dataframe\">\n",
  1704. " <thead>\n",
  1705. " <tr style=\"text-align: right;\">\n",
  1706. " <th></th>\n",
  1707. " <th></th>\n",
  1708. " <th></th>\n",
  1709. " <th></th>\n",
  1710. " <th>spend_prop</th>\n",
  1711. " <th>cpt</th>\n",
  1712. " </tr>\n",
  1713. " <tr>\n",
  1714. " <th>Audience Strategy</th>\n",
  1715. " <th>Audience Types</th>\n",
  1716. " <th>-</th>\n",
  1717. " <th>-</th>\n",
  1718. " <th></th>\n",
  1719. " <th></th>\n",
  1720. " </tr>\n",
  1721. " </thead>\n",
  1722. " <tbody>\n",
  1723. " <tr>\n",
  1724. " <th>Prospecting</th>\n",
  1725. " <th>Lookalike</th>\n",
  1726. " <th>-</th>\n",
  1727. " <th>-</th>\n",
  1728. " <td>11.831786</td>\n",
  1729. " <td>1005.098916</td>\n",
  1730. " </tr>\n",
  1731. " </tbody>\n",
  1732. "</table>\n",
  1733. "</div>"
  1734. ],
  1735. "text/plain": [
  1736. " spend_prop cpt\n",
  1737. "Audience Strategy Audience Types - - \n",
  1738. "Prospecting Lookalike - - 11.831786 1005.098916"
  1739. ]
  1740. },
  1741. "metadata": {},
  1742. "output_type": "display_data"
  1743. },
  1744. {
  1745. "data": {
  1746. "text/html": [
  1747. "<div>\n",
  1748. "<table border=\"1\" class=\"dataframe\">\n",
  1749. " <thead>\n",
  1750. " <tr style=\"text-align: right;\">\n",
  1751. " <th></th>\n",
  1752. " <th></th>\n",
  1753. " <th></th>\n",
  1754. " <th></th>\n",
  1755. " <th>spend_prop</th>\n",
  1756. " <th>cpt</th>\n",
  1757. " </tr>\n",
  1758. " <tr>\n",
  1759. " <th>Audience Strategy</th>\n",
  1760. " <th>Ad Type</th>\n",
  1761. " <th>Facebook Positions</th>\n",
  1762. " <th>Landing Pages</th>\n",
  1763. " <th></th>\n",
  1764. " <th></th>\n",
  1765. " </tr>\n",
  1766. " </thead>\n",
  1767. " <tbody>\n",
  1768. " <tr>\n",
  1769. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  1770. " <th rowspan=\"2\" valign=\"top\">Carousel</th>\n",
  1771. " <th rowspan=\"2\" valign=\"top\">feed</th>\n",
  1772. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  1773. " <td>3.466346</td>\n",
  1774. " <td>610.074862</td>\n",
  1775. " </tr>\n",
  1776. " <tr>\n",
  1777. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  1778. " <td>3.481535</td>\n",
  1779. " <td>518.258879</td>\n",
  1780. " </tr>\n",
  1781. " </tbody>\n",
  1782. "</table>\n",
  1783. "</div>"
  1784. ],
  1785. "text/plain": [
  1786. " spend_prop \\\n",
  1787. "Audience Strategy Ad Type Facebook Positions Landing Pages \n",
  1788. "Retention Carousel feed www.zivame.com/holi-special-half-price.html 3.466346 \n",
  1789. " www.zivame.com/panties/tummy-tucker-shaping-pan... 3.481535 \n",
  1790. "\n",
  1791. " cpt \n",
  1792. "Audience Strategy Ad Type Facebook Positions Landing Pages \n",
  1793. "Retention Carousel feed www.zivame.com/holi-special-half-price.html 610.074862 \n",
  1794. " www.zivame.com/panties/tummy-tucker-shaping-pan... 518.258879 "
  1795. ]
  1796. },
  1797. "metadata": {},
  1798. "output_type": "display_data"
  1799. },
  1800. {
  1801. "data": {
  1802. "text/html": [
  1803. "<div>\n",
  1804. "<table border=\"1\" class=\"dataframe\">\n",
  1805. " <thead>\n",
  1806. " <tr style=\"text-align: right;\">\n",
  1807. " <th></th>\n",
  1808. " <th></th>\n",
  1809. " <th></th>\n",
  1810. " <th></th>\n",
  1811. " <th>spend_prop</th>\n",
  1812. " <th>cpt</th>\n",
  1813. " </tr>\n",
  1814. " <tr>\n",
  1815. " <th>Audience Strategy</th>\n",
  1816. " <th>Audience Types</th>\n",
  1817. " <th>Landing Pages</th>\n",
  1818. " <th>-</th>\n",
  1819. " <th></th>\n",
  1820. " <th></th>\n",
  1821. " </tr>\n",
  1822. " </thead>\n",
  1823. " <tbody>\n",
  1824. " <tr>\n",
  1825. " <th rowspan=\"2\" valign=\"top\">Prospecting</th>\n",
  1826. " <th>Lookalike</th>\n",
  1827. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  1828. " <th>-</th>\n",
  1829. " <td>4.212631</td>\n",
  1830. " <td>691.737766</td>\n",
  1831. " </tr>\n",
  1832. " <tr>\n",
  1833. " <th>Open Targeting</th>\n",
  1834. " <th>www.zivame.com/no-sag-flat-30.html</th>\n",
  1835. " <th>-</th>\n",
  1836. " <td>2.477530</td>\n",
  1837. " <td>1033.938079</td>\n",
  1838. " </tr>\n",
  1839. " </tbody>\n",
  1840. "</table>\n",
  1841. "</div>"
  1842. ],
  1843. "text/plain": [
  1844. " spend_prop \\\n",
  1845. "Audience Strategy Audience Types Landing Pages - \n",
  1846. "Prospecting Lookalike www.zivame.com/panties/tummy-tucker-shaping-pan... - 4.212631 \n",
  1847. " Open Targeting www.zivame.com/no-sag-flat-30.html - 2.477530 \n",
  1848. "\n",
  1849. " cpt \n",
  1850. "Audience Strategy Audience Types Landing Pages - \n",
  1851. "Prospecting Lookalike www.zivame.com/panties/tummy-tucker-shaping-pan... - 691.737766 \n",
  1852. " Open Targeting www.zivame.com/no-sag-flat-30.html - 1033.938079 "
  1853. ]
  1854. },
  1855. "metadata": {},
  1856. "output_type": "display_data"
  1857. },
  1858. {
  1859. "data": {
  1860. "text/html": [
  1861. "<div>\n",
  1862. "<table border=\"1\" class=\"dataframe\">\n",
  1863. " <thead>\n",
  1864. " <tr style=\"text-align: right;\">\n",
  1865. " <th></th>\n",
  1866. " <th></th>\n",
  1867. " <th></th>\n",
  1868. " <th></th>\n",
  1869. " <th>spend_prop</th>\n",
  1870. " <th>cpt</th>\n",
  1871. " </tr>\n",
  1872. " <tr>\n",
  1873. " <th>Audience Strategy</th>\n",
  1874. " <th>Ad Format</th>\n",
  1875. " <th>Audience Types</th>\n",
  1876. " <th>Landing Pages</th>\n",
  1877. " <th></th>\n",
  1878. " <th></th>\n",
  1879. " </tr>\n",
  1880. " </thead>\n",
  1881. " <tbody>\n",
  1882. " <tr>\n",
  1883. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  1884. " <th rowspan=\"2\" valign=\"top\">Image</th>\n",
  1885. " <th rowspan=\"2\" valign=\"top\">Custom</th>\n",
  1886. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  1887. " <td>2.168894</td>\n",
  1888. " <td>630.018693</td>\n",
  1889. " </tr>\n",
  1890. " <tr>\n",
  1891. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  1892. " <td>2.363914</td>\n",
  1893. " <td>514.610046</td>\n",
  1894. " </tr>\n",
  1895. " </tbody>\n",
  1896. "</table>\n",
  1897. "</div>"
  1898. ],
  1899. "text/plain": [
  1900. " spend_prop \\\n",
  1901. "Audience Strategy Ad Format Audience Types Landing Pages \n",
  1902. "Retention Image Custom www.zivame.com/holi-special-half-price.html 2.168894 \n",
  1903. " www.zivame.com/panties/tummy-tucker-shaping-pan... 2.363914 \n",
  1904. "\n",
  1905. " cpt \n",
  1906. "Audience Strategy Ad Format Audience Types Landing Pages \n",
  1907. "Retention Image Custom www.zivame.com/holi-special-half-price.html 630.018693 \n",
  1908. " www.zivame.com/panties/tummy-tucker-shaping-pan... 514.610046 "
  1909. ]
  1910. },
  1911. "metadata": {},
  1912. "output_type": "display_data"
  1913. },
  1914. {
  1915. "data": {
  1916. "text/html": [
  1917. "<div>\n",
  1918. "<table border=\"1\" class=\"dataframe\">\n",
  1919. " <thead>\n",
  1920. " <tr style=\"text-align: right;\">\n",
  1921. " <th></th>\n",
  1922. " <th></th>\n",
  1923. " <th></th>\n",
  1924. " <th></th>\n",
  1925. " <th>spend_prop</th>\n",
  1926. " <th>cpt</th>\n",
  1927. " </tr>\n",
  1928. " <tr>\n",
  1929. " <th>Audience Strategy</th>\n",
  1930. " <th>Ad Type</th>\n",
  1931. " <th>Facebook Positions</th>\n",
  1932. " <th>Custom Audiences</th>\n",
  1933. " <th></th>\n",
  1934. " <th></th>\n",
  1935. " </tr>\n",
  1936. " </thead>\n",
  1937. " <tbody>\n",
  1938. " <tr>\n",
  1939. " <th>Retention</th>\n",
  1940. " <th>Carousel</th>\n",
  1941. " <th>feed</th>\n",
  1942. " <th>o2</th>\n",
  1943. " <td>5.866635</td>\n",
  1944. " <td>740.63498</td>\n",
  1945. " </tr>\n",
  1946. " </tbody>\n",
  1947. "</table>\n",
  1948. "</div>"
  1949. ],
  1950. "text/plain": [
  1951. " spend_prop \\\n",
  1952. "Audience Strategy Ad Type Facebook Positions Custom Audiences \n",
  1953. "Retention Carousel feed o2 5.866635 \n",
  1954. "\n",
  1955. " cpt \n",
  1956. "Audience Strategy Ad Type Facebook Positions Custom Audiences \n",
  1957. "Retention Carousel feed o2 740.63498 "
  1958. ]
  1959. },
  1960. "metadata": {},
  1961. "output_type": "display_data"
  1962. },
  1963. {
  1964. "data": {
  1965. "text/html": [
  1966. "<div>\n",
  1967. "<table border=\"1\" class=\"dataframe\">\n",
  1968. " <thead>\n",
  1969. " <tr style=\"text-align: right;\">\n",
  1970. " <th></th>\n",
  1971. " <th></th>\n",
  1972. " <th></th>\n",
  1973. " <th></th>\n",
  1974. " <th>spend_prop</th>\n",
  1975. " <th>cpt</th>\n",
  1976. " </tr>\n",
  1977. " <tr>\n",
  1978. " <th>Audience Strategy</th>\n",
  1979. " <th>Ad Format</th>\n",
  1980. " <th>Facebook Positions</th>\n",
  1981. " <th>Landing Pages</th>\n",
  1982. " <th></th>\n",
  1983. " <th></th>\n",
  1984. " </tr>\n",
  1985. " </thead>\n",
  1986. " <tbody>\n",
  1987. " <tr>\n",
  1988. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  1989. " <th rowspan=\"2\" valign=\"top\">Image</th>\n",
  1990. " <th rowspan=\"2\" valign=\"top\">feed</th>\n",
  1991. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  1992. " <td>3.466346</td>\n",
  1993. " <td>610.074862</td>\n",
  1994. " </tr>\n",
  1995. " <tr>\n",
  1996. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  1997. " <td>3.481535</td>\n",
  1998. " <td>518.258879</td>\n",
  1999. " </tr>\n",
  2000. " </tbody>\n",
  2001. "</table>\n",
  2002. "</div>"
  2003. ],
  2004. "text/plain": [
  2005. " spend_prop \\\n",
  2006. "Audience Strategy Ad Format Facebook Positions Landing Pages \n",
  2007. "Retention Image feed www.zivame.com/holi-special-half-price.html 3.466346 \n",
  2008. " www.zivame.com/panties/tummy-tucker-shaping-pan... 3.481535 \n",
  2009. "\n",
  2010. " cpt \n",
  2011. "Audience Strategy Ad Format Facebook Positions Landing Pages \n",
  2012. "Retention Image feed www.zivame.com/holi-special-half-price.html 610.074862 \n",
  2013. " www.zivame.com/panties/tummy-tucker-shaping-pan... 518.258879 "
  2014. ]
  2015. },
  2016. "metadata": {},
  2017. "output_type": "display_data"
  2018. },
  2019. {
  2020. "data": {
  2021. "text/html": [
  2022. "<div>\n",
  2023. "<table border=\"1\" class=\"dataframe\">\n",
  2024. " <thead>\n",
  2025. " <tr style=\"text-align: right;\">\n",
  2026. " <th></th>\n",
  2027. " <th></th>\n",
  2028. " <th></th>\n",
  2029. " <th></th>\n",
  2030. " <th>spend_prop</th>\n",
  2031. " <th>cpt</th>\n",
  2032. " </tr>\n",
  2033. " <tr>\n",
  2034. " <th>Audience Strategy</th>\n",
  2035. " <th>Ad Format</th>\n",
  2036. " <th>Publisher Platforms</th>\n",
  2037. " <th>Landing Pages</th>\n",
  2038. " <th></th>\n",
  2039. " <th></th>\n",
  2040. " </tr>\n",
  2041. " </thead>\n",
  2042. " <tbody>\n",
  2043. " <tr>\n",
  2044. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  2045. " <th rowspan=\"2\" valign=\"top\">Image</th>\n",
  2046. " <th rowspan=\"2\" valign=\"top\">facebook</th>\n",
  2047. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  2048. " <td>3.466346</td>\n",
  2049. " <td>610.074862</td>\n",
  2050. " </tr>\n",
  2051. " <tr>\n",
  2052. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  2053. " <td>3.481535</td>\n",
  2054. " <td>518.258879</td>\n",
  2055. " </tr>\n",
  2056. " </tbody>\n",
  2057. "</table>\n",
  2058. "</div>"
  2059. ],
  2060. "text/plain": [
  2061. " spend_prop \\\n",
  2062. "Audience Strategy Ad Format Publisher Platforms Landing Pages \n",
  2063. "Retention Image facebook www.zivame.com/holi-special-half-price.html 3.466346 \n",
  2064. " www.zivame.com/panties/tummy-tucker-shaping-pan... 3.481535 \n",
  2065. "\n",
  2066. " cpt \n",
  2067. "Audience Strategy Ad Format Publisher Platforms Landing Pages \n",
  2068. "Retention Image facebook www.zivame.com/holi-special-half-price.html 610.074862 \n",
  2069. " www.zivame.com/panties/tummy-tucker-shaping-pan... 518.258879 "
  2070. ]
  2071. },
  2072. "metadata": {},
  2073. "output_type": "display_data"
  2074. },
  2075. {
  2076. "data": {
  2077. "text/html": [
  2078. "<div>\n",
  2079. "<table border=\"1\" class=\"dataframe\">\n",
  2080. " <thead>\n",
  2081. " <tr style=\"text-align: right;\">\n",
  2082. " <th></th>\n",
  2083. " <th></th>\n",
  2084. " <th></th>\n",
  2085. " <th></th>\n",
  2086. " <th>spend_prop</th>\n",
  2087. " <th>cpt</th>\n",
  2088. " </tr>\n",
  2089. " <tr>\n",
  2090. " <th>Audience Strategy</th>\n",
  2091. " <th>Ad Type</th>\n",
  2092. " <th>Audience Types</th>\n",
  2093. " <th>Landing Pages</th>\n",
  2094. " <th></th>\n",
  2095. " <th></th>\n",
  2096. " </tr>\n",
  2097. " </thead>\n",
  2098. " <tbody>\n",
  2099. " <tr>\n",
  2100. " <th rowspan=\"2\" valign=\"top\">Retention</th>\n",
  2101. " <th rowspan=\"2\" valign=\"top\">Carousel</th>\n",
  2102. " <th rowspan=\"2\" valign=\"top\">Custom</th>\n",
  2103. " <th>www.zivame.com/holi-special-half-price.html</th>\n",
  2104. " <td>2.168894</td>\n",
  2105. " <td>630.018693</td>\n",
  2106. " </tr>\n",
  2107. " <tr>\n",
  2108. " <th>www.zivame.com/panties/tummy-tucker-shaping-panties.html</th>\n",
  2109. " <td>2.363914</td>\n",
  2110. " <td>514.610046</td>\n",
  2111. " </tr>\n",
  2112. " </tbody>\n",
  2113. "</table>\n",
  2114. "</div>"
  2115. ],
  2116. "text/plain": [
  2117. " spend_prop \\\n",
  2118. "Audience Strategy Ad Type Audience Types Landing Pages \n",
  2119. "Retention Carousel Custom www.zivame.com/holi-special-half-price.html 2.168894 \n",
  2120. " www.zivame.com/panties/tummy-tucker-shaping-pan... 2.363914 \n",
  2121. "\n",
  2122. " cpt \n",
  2123. "Audience Strategy Ad Type Audience Types Landing Pages \n",
  2124. "Retention Carousel Custom www.zivame.com/holi-special-half-price.html 630.018693 \n",
  2125. " www.zivame.com/panties/tummy-tucker-shaping-pan... 514.610046 "
  2126. ]
  2127. },
  2128. "metadata": {},
  2129. "output_type": "display_data"
  2130. },
  2131. {
  2132. "data": {
  2133. "text/html": [
  2134. "<div>\n",
  2135. "<table border=\"1\" class=\"dataframe\">\n",
  2136. " <thead>\n",
  2137. " <tr style=\"text-align: right;\">\n",
  2138. " <th></th>\n",
  2139. " <th></th>\n",
  2140. " <th></th>\n",
  2141. " <th></th>\n",
  2142. " <th>spend_prop</th>\n",
  2143. " <th>cpt</th>\n",
  2144. " </tr>\n",
  2145. " <tr>\n",
  2146. " <th>Audience Strategy</th>\n",
  2147. " <th>Ad Format</th>\n",
  2148. " <th>Facebook Positions</th>\n",
  2149. " <th>Custom Audiences</th>\n",
  2150. " <th></th>\n",
  2151. " <th></th>\n",
  2152. " </tr>\n",
  2153. " </thead>\n",
  2154. " <tbody>\n",
  2155. " <tr>\n",
  2156. " <th>Retention</th>\n",
  2157. " <th>Image</th>\n",
  2158. " <th>feed</th>\n",
  2159. " <th>o2</th>\n",
  2160. " <td>5.761855</td>\n",
  2161. " <td>732.243537</td>\n",
  2162. " </tr>\n",
  2163. " </tbody>\n",
  2164. "</table>\n",
  2165. "</div>"
  2166. ],
  2167. "text/plain": [
  2168. " spend_prop \\\n",
  2169. "Audience Strategy Ad Format Facebook Positions Custom Audiences \n",
  2170. "Retention Image feed o2 5.761855 \n",
  2171. "\n",
  2172. " cpt \n",
  2173. "Audience Strategy Ad Format Facebook Positions Custom Audiences \n",
  2174. "Retention Image feed o2 732.243537 "
  2175. ]
  2176. },
  2177. "metadata": {},
  2178. "output_type": "display_data"
  2179. },
  2180. {
  2181. "data": {
  2182. "text/html": [
  2183. "<div>\n",
  2184. "<table border=\"1\" class=\"dataframe\">\n",
  2185. " <thead>\n",
  2186. " <tr style=\"text-align: right;\">\n",
  2187. " <th></th>\n",
  2188. " <th></th>\n",
  2189. " <th></th>\n",
  2190. " <th></th>\n",
  2191. " <th>spend_prop</th>\n",
  2192. " <th>cpt</th>\n",
  2193. " </tr>\n",
  2194. " <tr>\n",
  2195. " <th>Audience Strategy</th>\n",
  2196. " <th>Ad Format</th>\n",
  2197. " <th>Publisher Platforms</th>\n",
  2198. " <th>Custom Audiences</th>\n",
  2199. " <th></th>\n",
  2200. " <th></th>\n",
  2201. " </tr>\n",
  2202. " </thead>\n",
  2203. " <tbody>\n",
  2204. " <tr>\n",
  2205. " <th>Retention</th>\n",
  2206. " <th>Image</th>\n",
  2207. " <th>facebook</th>\n",
  2208. " <th>o2</th>\n",
  2209. " <td>6.273405</td>\n",
  2210. " <td>764.712691</td>\n",
  2211. " </tr>\n",
  2212. " </tbody>\n",
  2213. "</table>\n",
  2214. "</div>"
  2215. ],
  2216. "text/plain": [
  2217. " spend_prop \\\n",
  2218. "Audience Strategy Ad Format Publisher Platforms Custom Audiences \n",
  2219. "Retention Image facebook o2 6.273405 \n",
  2220. "\n",
  2221. " cpt \n",
  2222. "Audience Strategy Ad Format Publisher Platforms Custom Audiences \n",
  2223. "Retention Image facebook o2 764.712691 "
  2224. ]
  2225. },
  2226. "metadata": {},
  2227. "output_type": "display_data"
  2228. },
  2229. {
  2230. "data": {
  2231. "text/html": [
  2232. "<div>\n",
  2233. "<table border=\"1\" class=\"dataframe\">\n",
  2234. " <thead>\n",
  2235. " <tr style=\"text-align: right;\">\n",
  2236. " <th></th>\n",
  2237. " <th></th>\n",
  2238. " <th></th>\n",
  2239. " <th></th>\n",
  2240. " <th>spend_prop</th>\n",
  2241. " <th>cpt</th>\n",
  2242. " </tr>\n",
  2243. " <tr>\n",
  2244. " <th>Audience Strategy</th>\n",
  2245. " <th>Ad Type</th>\n",
  2246. " <th>Publisher Platforms</th>\n",
  2247. " <th>Custom Audiences</th>\n",
  2248. " <th></th>\n",
  2249. " <th></th>\n",
  2250. " </tr>\n",
  2251. " </thead>\n",
  2252. " <tbody>\n",
  2253. " <tr>\n",
  2254. " <th>Retention</th>\n",
  2255. " <th>Carousel</th>\n",
  2256. " <th>facebook</th>\n",
  2257. " <th>o2</th>\n",
  2258. " <td>6.378185</td>\n",
  2259. " <td>772.558035</td>\n",
  2260. " </tr>\n",
  2261. " </tbody>\n",
  2262. "</table>\n",
  2263. "</div>"
  2264. ],
  2265. "text/plain": [
  2266. " spend_prop \\\n",
  2267. "Audience Strategy Ad Type Publisher Platforms Custom Audiences \n",
  2268. "Retention Carousel facebook o2 6.378185 \n",
  2269. "\n",
  2270. " cpt \n",
  2271. "Audience Strategy Ad Type Publisher Platforms Custom Audiences \n",
  2272. "Retention Carousel facebook o2 772.558035 "
  2273. ]
  2274. },
  2275. "metadata": {},
  2276. "output_type": "display_data"
  2277. },
  2278. {
  2279. "data": {
  2280. "text/html": [
  2281. "<div>\n",
  2282. "<table border=\"1\" class=\"dataframe\">\n",
  2283. " <thead>\n",
  2284. " <tr style=\"text-align: right;\">\n",
  2285. " <th></th>\n",
  2286. " <th></th>\n",
  2287. " <th></th>\n",
  2288. " <th></th>\n",
  2289. " <th>spend_prop</th>\n",
  2290. " <th>cpt</th>\n",
  2291. " </tr>\n",
  2292. " <tr>\n",
  2293. " <th>Audience Strategy</th>\n",
  2294. " <th>Ad Type</th>\n",
  2295. " <th>Audience Types</th>\n",
  2296. " <th>Custom Audiences</th>\n",
  2297. " <th></th>\n",
  2298. " <th></th>\n",
  2299. " </tr>\n",
  2300. " </thead>\n",
  2301. " <tbody>\n",
  2302. " <tr>\n",
  2303. " <th>Retention</th>\n",
  2304. " <th>Carousel</th>\n",
  2305. " <th>Custom</th>\n",
  2306. " <th>o2</th>\n",
  2307. " <td>6.378185</td>\n",
  2308. " <td>772.558035</td>\n",
  2309. " </tr>\n",
  2310. " </tbody>\n",
  2311. "</table>\n",
  2312. "</div>"
  2313. ],
  2314. "text/plain": [
  2315. " spend_prop \\\n",
  2316. "Audience Strategy Ad Type Audience Types Custom Audiences \n",
  2317. "Retention Carousel Custom o2 6.378185 \n",
  2318. "\n",
  2319. " cpt \n",
  2320. "Audience Strategy Ad Type Audience Types Custom Audiences \n",
  2321. "Retention Carousel Custom o2 772.558035 "
  2322. ]
  2323. },
  2324. "metadata": {},
  2325. "output_type": "display_data"
  2326. },
  2327. {
  2328. "data": {
  2329. "text/html": [
  2330. "<div>\n",
  2331. "<table border=\"1\" class=\"dataframe\">\n",
  2332. " <thead>\n",
  2333. " <tr style=\"text-align: right;\">\n",
  2334. " <th></th>\n",
  2335. " <th></th>\n",
  2336. " <th></th>\n",
  2337. " <th></th>\n",
  2338. " <th>spend_prop</th>\n",
  2339. " <th>cpt</th>\n",
  2340. " </tr>\n",
  2341. " <tr>\n",
  2342. " <th>Audience Strategy</th>\n",
  2343. " <th>Ad Format</th>\n",
  2344. " <th>Audience Types</th>\n",
  2345. " <th>Custom Audiences</th>\n",
  2346. " <th></th>\n",
  2347. " <th></th>\n",
  2348. " </tr>\n",
  2349. " </thead>\n",
  2350. " <tbody>\n",
  2351. " <tr>\n",
  2352. " <th>Retention</th>\n",
  2353. " <th>Image</th>\n",
  2354. " <th>Custom</th>\n",
  2355. " <th>o2</th>\n",
  2356. " <td>6.273405</td>\n",
  2357. " <td>764.712691</td>\n",
  2358. " </tr>\n",
  2359. " </tbody>\n",
  2360. "</table>\n",
  2361. "</div>"
  2362. ],
  2363. "text/plain": [
  2364. " spend_prop \\\n",
  2365. "Audience Strategy Ad Format Audience Types Custom Audiences \n",
  2366. "Retention Image Custom o2 6.273405 \n",
  2367. "\n",
  2368. " cpt \n",
  2369. "Audience Strategy Ad Format Audience Types Custom Audiences \n",
  2370. "Retention Image Custom o2 764.712691 "
  2371. ]
  2372. },
  2373. "metadata": {},
  2374. "output_type": "display_data"
  2375. }
  2376. ],
  2377. "source": [
  2378. "good_new, good_impacts = get_filtered_paths(good_raw)\n",
  2379. "good_impacts_list = [value[0] for value in good_impacts]\n",
  2380. "for key, value in good_new.items():\n",
  2381. " if key in good_impacts_list[0:]:\n",
  2382. " b = pd.DataFrame().from_dict(value, orient='index')\n",
  2383. " none_list = ['-']*len(tag_list)\n",
  2384. " l = list(key)\n",
  2385. " none_list[:len(l)] = l\n",
  2386. "\n",
  2387. " b.index = b.index.set_names(none_list)\n",
  2388. "\n",
  2389. " display(b)"
  2390. ]
  2391. },
  2392. {
  2393. "cell_type": "code",
  2394. "execution_count": null,
  2395. "metadata": {
  2396. "collapsed": true
  2397. },
  2398. "outputs": [],
  2399. "source": []
  2400. }
  2401. ],
  2402. "metadata": {
  2403. "anaconda-cloud": {},
  2404. "kernelspec": {
  2405. "display_name": "Python [jarvis1]",
  2406. "language": "python",
  2407. "name": "Python [jarvis1]"
  2408. },
  2409. "language_info": {
  2410. "codemirror_mode": {
  2411. "name": "ipython",
  2412. "version": 3
  2413. },
  2414. "file_extension": ".py",
  2415. "mimetype": "text/x-python",
  2416. "name": "python",
  2417. "nbconvert_exporter": "python",
  2418. "pygments_lexer": "ipython3",
  2419. "version": "3.5.2"
  2420. }
  2421. },
  2422. "nbformat": 4,
  2423. "nbformat_minor": 0
  2424. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement