使用JSON将数据从Python导出到Tableau吗? [英] Export data from Python into Tableau using JSON?

查看:227
本文介绍了使用JSON将数据从Python导出到Tableau吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以表格形式从Python到Tableau获得400万行和28列?

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

我假设(基于搜索)我应该使用JSON格式.这种格式可以处理大量数据,并且速度足够快.

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

我制作了12行数据的子集,并试图使其正常工作.好消息是:它正在运行.坏消息:不是我想要的方式.

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.

我的问题是,当我在Tableau中导入它时,它看起来并不像表.我已尝试在此处显示的差异>.

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.

这是Python(熊猫)中的语句:

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')

也许我在Tableau中选择了太多模式(全部选择了它们),但是我认为我的问题出在Python中.我需要使用其他库而不是熊猫吗?还是我需要更改变量?

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?

也欢迎其他方式.我没有使用JSON的偏好,但是基于搜索结果,我认为这是最好的方法.

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

注意:我是python和tableau的新手:)我使用python 3.5.2,并在Jupyter中工作.在Tableau中,我只有免费的桌面试用版.

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.

推荐答案

JSON对于某些类型的数据很有用,但是如果您的DataFrame是纯表格格式的(没有MultiIndexes,复杂的对象等)并且包含简单的数据类型(字符串) ,数字,浮点数),那么逗号分隔值(CSV)文本文件可能是最好的格式,因为它占用的空间最少.使用 to_csv() 方法,并且有许多可用的自定义选项.我对Tableau并不十分熟悉,但是根据他们的网站 CSV文件是受支持的输入格式.

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.

这篇关于使用JSON将数据从Python导出到Tableau吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆