Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink DataFrame
  • PyFlink Common
  • API Reference
  • PyFlink Table
  • TableEnvironment
  • pyflink.table.table_environment.StreamTableEnvironment.from_pandas

pyflink.table.table_environment.StreamTableEnvironment.from_pandas#

StreamTableEnvironment.from_pandas(pdf: pandas.DataFrame, schema: RowType | List[str] | Tuple[str] | List[DataType] | Tuple[DataType] = None, splits_num: int = 1) → Table#

Creates a table from a pandas DataFrame.

Example:

>>> pdf = pd.DataFrame(np.random.rand(1000, 2))
# use the second parameter to specify custom field names
>>> table_env.from_pandas(pdf, ["a", "b"])
# use the second parameter to specify custom field types
>>> table_env.from_pandas(pdf, [DataTypes.DOUBLE(), DataTypes.DOUBLE()]))
# use the second parameter to specify custom table schema
>>> table_env.from_pandas(pdf,
...                       DataTypes.ROW([DataTypes.FIELD("a", DataTypes.DOUBLE()),
...                                      DataTypes.FIELD("b", DataTypes.DOUBLE())]))
Parameters:
  • pdf – The pandas DataFrame.

  • schema – The schema of the converted table.

  • splits_num – The number of splits the given Pandas DataFrame will be split into. It determines the number of parallel source tasks. If not specified, the default parallelism will be used.

Returns:

The result table.

Added in version 1.11.0.

previous

pyflink.table.table_environment.StreamTableEnvironment.from_elements

next

pyflink.table.table_environment.StreamTableEnvironment.from_path

On this page
  • StreamTableEnvironment.from_pandas()

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.