The fastexport() function exports teradataml DataFrame to Pandas DataFrame using the FastExport data transfer protocol. FastExport opens multiple data transfer connections to the database.
Teradata recommends using fastexport() function when number of rows in the teradataml DataFrame is at least 100,000. To extract lesser rows, you can ignore this function and use regular to_pandas() function.
- FastExport does not support all Teradata database data types.
For example, tables with BLOB and CLOB type columns cannot be extracted.
- FastExport cannot be used to extract data from a volatile or temporary table.
- For best efficiency, do not use DataFrame.groupby() and DataFrame.sort() with FastExport.
- When export_to is set to 'pandas' and catch_errors_warnings is set to True, the fastexport() function returns a tuple containing:
- Pandas DataFrame.
- Errors, if any, thrown by fastexport in a list of strings.
- Warnings, if any, thrown by fastexport in a list of strings.
- When export_to is set to 'pandas' and catch_errors_warnings is set to False, the fastexport() function returns a Pandas DataFrame.
See the FastExport section of https://pypi.org/project/teradatasql/ for more information about FastExport protocol through teradatasql driver.
Example Prerequisites
>>> from teradataml import fastexport
>>> load_example_data("dataframe", "admissions_train")
>>> df = DataFrame("admissions_train")
Example 1: Export teradataml DataFrame 'df' to Pandas DataFrame
>>> fastexport(df)
Example 2: Export teradataml DataFrame 'df' to Pandas DataFrame with settings
This example exports the teradataml DataFrame 'df' to Pandas DataFrame, set index column, coerce_float and catch errors/warnings thrown by fastexport.
>>> pandas_df, err, warn = fastexport(df, index_column="gpa", coerce_float=True)
# Print pandas DataFrame. >>> pandas_df
# Print errors list. >>> err
# Print warnings list. >>> warn