Connecting to APIs in Tableau Desktop using Python & TabPy
Вставка
- Опубліковано 2 тра 2024
- Don't forget to click Subscribe if you want more weekly data-related updates!
Sometimes we want to connect directly to third-party data to enrich our analysis. For example, if you're looking at daily foreign exchange data it's more efficient to get this data directly through a API, on a daily basis. But how do you do this in Tableau?
Join Tableau DataDev Ambassador Anya Prosvetova to learn how to extend Tableau's capabilities, and dynamically bring data from an external API directly to your Tableau dashboard using Python and TabPy
Timestamps:
0:00 - Intro
1:20 - Intro to APIs
3:30 - What is TabPy?
4:00 - Intro to SCRIPT calcs
8:50 - Writing & testing our script
14:00 - Launching Tabpy
19:20 - Building SCRIPT calcs
Links:
- Read TabPy documentation: github.com/tableau/TabPy
- Read about TabPy configuration and security: tabscifi.golovatyi.info/
- Learn more about data science in Tableau Desktop: www.tableau.com/about/blog/2018/8/working-external-services-tableau-tabpy-r-matlab-93351
- Explore practical examples from Tableau: www.tableau.com/about/blog/2017/1/building-advanced-analytics-applications-tabpy-64916
- Join Tableau Developer Program: www.tableau.com/developer
- Install and Run TabPy on AWS EC2 video: • Analytics in the Cloud...
- TabPy on Prep Conductor video: • TabPy on Prep Conductor
- Connect with Anya on LinkedIn: / annaprosvetova
- Follow Anya on Twitter: / anyalitica
- See Anya's blog: www.prosvetova.com/
----------------------------------------------------------------------------------------------------
Want more information about us? Head over to theinformationlab.co.uk
Want to see more of our events? Head over to til.bi/talkdata to find out more
---------------------------------------------------------------------------------------------------- - Наука та технологія
Clear voice focused and to the point. Very
useful info. Appreciated!
Very good video. Helped me a lot. Thank you very much.
How did you create the "Selected country" field? Thank you!
Hi, the _arg1[0] is not working for me and I'm getting a key error. are there further changes to the API?
Can anyone provide a link on how to set-up tabpy to tableau web server/ online. I am able to connect tabpy to Tableau Desktop. But if I want others to also access tabpy functionalities, i need Tableau Web server to talk to tabpy
Do we need to download condo complusory?
Whats the best way to call REST APIs through tableau that has results in data frame?
Very useful video, thank you!! I try this test and having an error with the _arg1. Don't recognize it
Hi Sebastian, due to a change in the API, you'll need to use _arg1[0] instead. Hope that helps!
Thank you
I'm new to tableau. How did you managed to get that "selected country" field just below that misc filter box?
Hi CK, there's a field and a parameter called "Selected country". The parameter can easily be created by clicking on the dropdown-arrow in your data pane and select "Create Parameter". Set the data type to be a string and allow "all values". The field is a calculated field, the formula of which is shown at 31:30.
@@anyaprosvetova9824 thank you very much!
How to return single string value in calculated field using Tableau data from python and present it on new sheet of Tableau as Text value.
For example, Data contains lists of cities and population of city. These are represented in graph in Tableau. We would like to find city having maximum population. Python code is written using max function. The python code is returning correct value to tableau, however there are multiple rows returned to tableau while I need only single value.
Incase we are using label for returning maximum population in Tableau, it doesn’t return any value if we are not passing parameters in row and column field which are used in python code.
Below python code is used to find maximum population in city:
SCRIPT_STR("
city_list = _arg2
population_list = _arg1
highest_population = max(population_list)
ind = population_list.index(highest_population)
city_name = city_list [ind]
output_str = ' '+str(city_name)+' with highest population: '+str(highest_population)
return output_str
", ATTR([City]),SUM([Population]))
Hello, is it possible to connect API in Tableau Public too? or is it possible only with Tableau Desktop?
Hello! Tableau Public doesn't permit the use of TabPy, so for an example in this video, it would have to be on Tableau Desktop.
how to get the URL
How to get the data set ? could you please provide the dataset?
Hello Gaurav, this is the World Indicators dataset which is included with Tableau Desktop by default. You can access it by looking in the 'Saved Data Sources' section of the Connect pane when you load Tableau.
Was working, but recently I tried to do it again and I receive it an error
An error occurred while communicating with the Analytics Extension.
Error processing script
KeyError : 0
you have to include [0]. _Arg1[0] should be working
@@MarcelKol27 Thank you so much :)
@@MarcelKol27 Lost half a day till I saw your comment. Is this some new rule? This should be also present if I am doing some other APIs (_arg1 should have [0]) or this is just for this particular case? Why did it change than it was before like in this video presentation? Thank you.
where did selected country come from?
There's a field and a parameter called "Selected country". The parameter can easily be created by clicking on the dropdown-arrow in your data pane and select "Create Parameter". Set the data type to be a string and allow "all values". The field is a calculated field, the formula of which is shown at 31:30.