2

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
Hoksie
  • 23
  • 3

1 Answers1

3

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • MattDMo is correct. Once you have a csv file, Tableau will connect and read it without any further requirements. – vizyourdata Jan 07 '17 at 20:59
  • Ok thanks! I thought Json would be the best way. I tried csv with a smaller dataset and that worked. So no problem to get csv working. Thanks for your answers! – Hoksie Jan 09 '17 at 08:48
  • wouldn't xlsx be way more efficient? – Mr1159pm May 14 '20 at 16:45
  • @Mr1159pm why would it be more efficient? The `csv` module built in to Python is quite fast and efficient, and CSV files take up less space than the equivalent pure tabular data stored in a native Excel spreadsheet, which contains all kinds of XML overhead. – MattDMo May 14 '20 at 22:37