I am trying to plot a sankey chart and running into the issue that I am not able to plot same node interactions that happen in sequence. For example, I have sankey_df:
user |date |Source | Target | Price
1 |01-01-2022 |A | B | 10
1 |02-01-2022 |A | B | 15
This is how I plot it but it does not render (because I have the same source/target connections.
product_list = list(set(sankey['target']))+list(set(sankey['source']))
di = {element:index for index,element in enumerate(product_list)}
#apply to df to convert source/target names to numerics
sankey=sankey.replace({"source": di,"target": di })
# data
import plotly.graph_objs as go1
import plotly.offline as pyo
# Set notebook mode to work in offline
pyo.init_notebook_mode()
%matplotlib inline
source = list(sankey['source'])
target = list(sankey['target'])
value = list(sankey['price'])
# data to dict, dict to sankey
link = dict(source = source, target = target, value = value)
label=product_list
node = dict(label = label, pad=20, thickness=10)
data = go1.Sankey(link = link, node=node)
# plot
fig = go1.Figure(data)
fig.show(renderer="colab")
When I run the code, it does not throw an error but it does not show anything. When I change the source/target relation to something unique, it renders. I want to allow same-sequenced interactions. How do I enable this?