I have not personally tried to create Tableau visualizations through Python, but there does exist a python library called TabPy.
This library is currently being developed by the Tableau team, and is under Beta/development.
Execute Python code on the fly and display results in Tableau visualizations - tableau/TabPy
How to get Startedhttps://github.com/tableau/TabPy/blob/master/client.md
The following security issues should be kept in mind as you use TabPy with Tableau:
The data channel between Tableau and TabPy is currently not encrypted.
TabPy currently does not use authentication.
Python scripts can contain code which can harm security on the server where the TabPy is running. For example:
Access file system (read/write)
Install new Python packages which can contain binary code
Execute operating system commands
Open network connections to other servers and download files