Skip to content

Commit db57f6d

Browse files
author
Luan Gabriel Silva Fernandes
committed
test and notebook changes
1 parent 8c35772 commit db57f6d

File tree

2 files changed

+4061
-4
lines changed

2 files changed

+4061
-4
lines changed

Google_Demo_Attribution(MAM).ipynb

Lines changed: 4032 additions & 1 deletion
Large diffs are not rendered by default.

test.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,35 @@
55

66
from marketing_attribution_models import MAM
77

8+
np.random.seed(42)
9+
810
pd.set_option("display.float_format", lambda x: "%.3f" % x)
911
pd.set_option("max_colwidth", None)
1012

11-
df = pd.read_csv("/home/luanfernandes/Downloads/sessions.csv")
13+
users = [
14+
# "1472526294.1645135142",
15+
"1317354717.1641321280",
16+
# "679601293.1636465111"
17+
]
18+
19+
df = pd.read_csv(
20+
"/home/luanfernandes/Downloads/sessions-full.csv",
21+
dtype={
22+
"user_pseudo_id": str,
23+
"session_id": str,
24+
"user_id": str,
25+
"is_conversion": bool,
26+
"source_medium": str,
27+
"partition_date": str,
28+
},
29+
parse_dates=True,
30+
)
31+
df = df[df.user_pseudo_id.isin(users)].sample(frac=1.0)
32+
1233
df = df.drop(
1334
columns=[
14-
"page_referrer",
15-
"page_location",
35+
# "page_referrer",
36+
# "page_location",
1637
"utm_source",
1738
"utm_medium",
1839
"utm_campaign",
@@ -39,3 +60,8 @@
3960
DP_tribution.as_pd_dataframe()
4061

4162
DP_tribution.attribution_last_click()
63+
DP_tribution.attribution_time_decay()
64+
65+
print(DP_tribution.DataFrame)
66+
67+
print(DP_tribution.original_df)

0 commit comments

Comments
 (0)