Skip to main content
Version: 3.13

markov_model

Python

### Import libraries

from ChannelAttributionPro import *
pd.set_option('display.expand_frame_repr', False)

### Set your token

token="yourtoken"

### Load data

Data = pd.read_csv("https://app.channelattribution.io/data/Data.csv",sep=";")

print(Data)

### Perform transaction level attribution reading data from a data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", var_value="total_conversion_value", \
var_null="total_null", cha_sep=">")
path_attribution=res["attribution"]
print(path_attribution)

### Return non converting paths in the output data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", var_value="total_conversion_value", \
var_null="total_null", cha_sep=">", flg_write_nulls=1)
path_attribution=res["attribution"]
print(path_attribution)

### Return paths in the output data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", var_value="total_conversion_value", \
var_null="total_null", cha_sep=">", flg_write_paths=1)
path_attribution=res["attribution"]
print(path_attribution)