check the below links that has work book embedded and detailed documentation that will guide you through.
You need to integrate tabPY with tableau to use python with tableau.check the below links.
script_*() functions needs to be used to send data to python through tableau.
hope it helps you.
Incase my answer is helpful,please mark it as correct.
cheers and BR,
NP Andrea,i am glad to know you solved it.