'generator' object is not callable when if inside a for loop in list compression
0
0
I am getting the following error when i ran this: df['initial_referrer'].apply(lambda x: value.split("utm_campaign=",1)[1] if 'utm_campaign' in value else np.nan for value in x.split('&')) TypeError: 'generator' object is not callable I am not sure the meaning of the error and how to modify my this to get rid of this. I have read couple of similar questions here but could not figure our what could be the issue. So I have values in df['initial_referrer'] be like: df['initial_referrer'].head() 0 /login/index.php 1 /login/index.php?utm_source=INTERNAL&utm_medium=EMAIL&utm_campaign=login-day1 2 /login/index.php 3 /login/index.php?utm_source=INTERNAL&utm_medium=EMAIL&utm_campaign=login-day1 4 /login/index.php ...