Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export data from Python to Tableau directly

I have a python code that exports data into a csv, then I load that csv into Tableau. I don't want to load a csv into tableau.

Is there a way I can just take the return value of my python script and put it directly into tableau?

Question is similar to Export data from Python into Tableau using JSON? , but they inquire about Json format and the answer was to use csv. I want to skip csv step if possible. The data im returning will be in a tabular format.

like image 411
excelguy Avatar asked Feb 26 '19 14:02

excelguy


People also ask

Can I connect Python to Tableau?

To include Python scripts in your flow, you need to configure a connection between Tableau and a TabPy server. Then you can use Python scripts to apply supported functions to data from your flow using a pandas dataframe.


1 Answers

Consider using TabPy. It returns values created by scripts as calculated fields within a workbook.

Otherwise, Tableau purely operates as a layer on top of a source of data. There is no such thing, unfortunately, as loading data directly into it.

The way I typically handle jobs like this is to have Python load data directly into a data store of some sort. All new information - or overwritten information - is then viewable with the existing data connection of your Tableau workbook.

A simple way to do this, without having to use a formal database is to consistently load the CSV into the same place with the same name. Then once Tableau is opened with the pre-existing connection, all that is needed is a click of 'refresh.'

I understand that your goal is to have Tableau populate your data directly from Python, and I'm sorry this isn't the answer you probably wanted, but there is some backend work that needs to be done. If done properly, though, the end effect to any user could appear to render directly from Python.

like image 124
MonteCarloSims Avatar answered Sep 28 '22 11:09

MonteCarloSims