Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a Tableau .hyper File to a pandas dataframe?

I want to convert a Tableau .hyper file to a pandas dataframe. It is possible to convert a dataframe to a .hyper file, but unfortunately, I could not come up with a solution for this problem. How can you achieve this with python?

like image 901
btinman Avatar asked Apr 08 '19 13:04

btinman


1 Answers

The accepted answer is outdated. You no longer need to use Tableau Desktop, you can now read .hyper files directly.

In October, we released the new Hyper API, which can read .hyper files in Python. Subsequently, the pantab library was updated to use Hyper API and is now also able to read data frames from a .hyper file. Thus, you can now use its frame_from_hyper method to do that:

result = pantab.frame_from_hyper(database=<PATH TO YOUR HYPER FILE>, table=<TABLE INSIDE THE HYPER FILE>)

If you don't know the name of the table insider your .hyper file or if you have multiple tables in your file, you can also use frames_from_hyper, which will give you a dictionary { table name -> data frame }, i.e., one frame for each table in the file:

result = pantab.frames_from_hyper(database=<PATH TO YOUR HYPER FILE>)
like image 85
gexicide Avatar answered Oct 14 '22 05:10

gexicide