DP6 / Marketing-Attribution-Models

Python Class created to address problems regarding Digital Marketing Attribution.
https://dp6.github.io/Marketing-Attribution-Models
Apache License 2.0
302 stars 80 forks source link

[BUG] AttributeError: 'NoneType' object has no attribute 'copy' - with random_df=True #49

Closed RicSpd closed 2 years ago

RicSpd commented 2 years ago

Describe the bug I recently re-installed this package because I saw, in my experiments, that the position-based attribution model was bugged; this issue was solved in #44. After re-installing the package with the new version 1.0.9 (before I had 1.0.8), when creating a MAM object with random_df=True I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
      1 # set seed for reproducibility
      2 random.seed(1337)
----> 3 attributions = MAM(random_df=True)

C:\Users\... in __init__(self, df, time_till_conv_colname, conversion_value, channels_colname, journey_with_conv_colname, group_channels, group_channels_by_id_list, group_timestamp_colname, create_journey_id_based_on_conversion, path_separator, verbose, random_df)
     93         ##########################################################
     94 
---> 95         self._original_df = df.copy()
     96 
     97         self._first_click = None

AttributeError: 'NoneType' object has no attribute 'copy'

To Reproduce Package versions:

Code used:

import random
import numpy as np
import pandas as pd
from marketing_attribution_models import MAM

random.seed(1337)
attributions = MAM(random_df=True)

Here I get the error posted above (I removed my paths). I suspect that it is due to the fact that, prior to this, the check for the request of a random dataframe was specified before assigning df.copy() to self.original_df.

divyesh-mangroliya-inferenz commented 2 years ago

still this bug is not solved

Nathandsn commented 2 years ago

This issue was solved in commit #48, you can download the version 1.0.10 with this fix.