Export data from Python into Tableau using JSON?

旧时模样 提交于 2019-12-05 05:21:22

问题


How do I get 4 million rows and 28 columns from Python to Tableau in a table form?

I assume (based on searching) that I should use a JSON format. This format can handle a lot of data and is fast enough.

I have made a subset of 12 rows of the data and tried to get it working. The good news is: it's working. The bad news: not the way I want to.

My issue is that when I import it in Tableau it doesn't look like a table. I have tried the variances which are displayed here.

This is the statement in Python (pandas):

jsonfile = pbg.to_json("//vsv1f40/Pricing_Management$/Z-DataScience/01_Requests/Marketing/Campaign_Dashboard/Bronbestanden/pbg.json",orient='values')

Maybe I select too many schemas in Tableau (I select them all), but I think my problem is in Python. Do I need to use another library instead of Pandas? Or do I need to change the variables?

Other ways are also welcome. I have no preference for JSON, but I thought that was the best way, based on the search results.

Note: I am new to python and tableau :) I use python 3.5.2 and work in Jupyter. From Tableau I only have the free trial desktop version.


回答1:


JSON is good for certain types of data, but if your DataFrame is purely tabular (no MultiIndexes, complex objects, etc.) and contains simple data types (strings, digits, floats), then a comma-separated value (CSV) text file is probably the best format to use, as it would take up the least space. A DataFrame can easily be saved as a CSV using the to_csv() method, and there are a number of customization options available. I'm not terribly familiar with Tableau, but according to their website CSV files are a supported input format.



来源:https://stackoverflow.com/questions/41508873/export-data-from-python-into-tableau-using-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!