{"id":9168,"library":"pantab","title":"Pantab: Pandas DataFrames to Tableau Hyper Extracts","description":"Pantab is a Python library that enables seamless conversion between pandas DataFrames and Tableau Hyper Extracts (.hyper files). It provides a high-performance way to get data into and out of Tableau's Hyper engine, which is used for data storage and querying within Tableau products. The current version is 5.3.0, and it generally follows a release cadence with minor versions every few months, often including bug fixes and Python version support updates.","status":"active","version":"5.3.0","language":"en","source_language":"en","source_url":"https://github.com/innobi/pantab","tags":["pandas","tableau","hyper","data-export","data-import","business-intelligence"],"install":[{"cmd":"pip install pantab","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core data structure for conversion.","package":"pandas"},{"reason":"Underlying library for interacting with Tableau Hyper files.","package":"tableauhyperapi"}],"imports":[{"note":"While 'pantab.frame.to_hyper' works, 'from pantab import to_hyper' is the recommended and more common direct import.","wrong":"import pantab.frame.to_hyper","symbol":"to_hyper","correct":"from pantab import to_hyper"},{"note":"Similar to 'to_hyper', direct import is preferred for convenience.","wrong":"import pantab.frame.frame_from_hyper","symbol":"frame_from_hyper","correct":"from pantab import frame_from_hyper"}],"quickstart":{"code":"import pandas as pd\nimport pantab as pt\nimport os\n\ndata = {\n    'col1': [1, 2, 3],\n    'col2': ['A', 'B', 'C'],\n    'col3': [True, False, True]\n}\ndf = pd.DataFrame(data)\n\nhyper_file = 'my_data.hyper'\ntable_name = 'MyTable'\n\ntry:\n    # Write DataFrame to Hyper file\n    pt.to_hyper(df, hyper_file, table=table_name)\n    print(f\"DataFrame written to {hyper_file} successfully.\")\n\n    # Read DataFrame from Hyper file\n    read_df = pt.frame_from_hyper(hyper_file, table=table_name)\n    print(f\"DataFrame read from {hyper_file} successfully:\")\n    print(read_df)\n\nfinally:\n    # Clean up the generated file\n    if os.path.exists(hyper_file):\n        os.remove(hyper_file)\n        print(f\"Cleaned up {hyper_file}.\")","lang":"python","description":"This quickstart demonstrates how to create a pandas DataFrame, write it to a Tableau Hyper file using `pantab.to_hyper`, and then read it back into a DataFrame using `pantab.frame_from_hyper`. It includes cleanup to remove the generated Hyper file."},"warnings":[{"fix":"Upgrade your Python environment to 3.11 or newer, or pin your pantab version to <5.3.0.","message":"Pantab v5.3.0 dropped support for Python 3.9 and 3.10. Users on these Python versions will need to upgrade to Python 3.11 or later to use the latest Pantab.","severity":"breaking","affected_versions":">=5.3.0"},{"fix":"Ensure `tableauhyperapi` is updated to at least the minimum version required by your `pantab` installation. Running `pip install --upgrade pantab` usually resolves this by updating its dependencies.","message":"Pantab relies on `tableauhyperapi`, which periodically updates its minimum required version. Older `tableauhyperapi` versions can lead to `RuntimeError` or `ValueError`.","severity":"breaking","affected_versions":"All versions, specifically 4.1.0+ and 5.0.0+"},{"fix":"Review `pantab` documentation for specific data type mappings to ensure your data integrity and expected column types in Tableau. Test conversions with representative datasets.","message":"Data type mapping between pandas and Hyper can have nuances. For instance, 8-bit integer columns in pandas will be stored as 16-bit integers in Hyper. Other types might also undergo conversions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the process writing or reading the Hyper file has appropriate file system permissions. Avoid concurrent writes to the same Hyper file. Close file handlers properly if managing them manually (though `pantab` generally handles this).","message":"Hyper files are single-writer, single-reader. Concurrent access or insufficient file permissions can lead to errors, especially on network drives or shared environments.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Use `table_mode='a'` to append, or `table_mode='w'` to overwrite the *entire file* if you intend to replace the whole content. If you only want to overwrite a specific table, you need to first delete the table or overwrite the file. The `table` argument in `to_hyper` and `frame_from_hyper` specifies the table within the Hyper file.","cause":"Attempting to write to a Hyper file with `table_mode='w'` (default for `to_hyper`) where the specified table name already exists in the file, and the file is not empty.","error":"RuntimeError: hyper_error_code = 701: A table with name 'MyTable' already exists."},{"fix":"Run `pip install pantab` to install the library.","cause":"The `pantab` library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'pantab'"},{"fix":"Ensure `pantab` and `tableauhyperapi` are correctly installed: `pip install --upgrade pantab tableauhyperapi`. Sometimes, a fresh environment or system re-install of Hyper API dependencies might be needed if `pip` fails to resolve it.","cause":"The underlying `tableauhyperapi` library or its native components are missing or corrupted, or the environment is not set up correctly to find them.","error":"tableauhyperapi.TableauHyperAPILibraryError: The Hyper API library could not be loaded. Please ensure that the Tableau Hyper API is installed and accessible."},{"fix":"Ensure you pass a valid string or `pathlib.Path` object for the `file_path` argument, specifying the `.hyper` file you want to interact with.","cause":"The `file_path` argument for `to_hyper` or `frame_from_hyper` was not provided or was `None`.","error":"TypeError: 'file_path' must be a Path or str, not NoneType"}]}