ENH: Add to_tf_dataset method to convert Pandas dataframe to TensorFlow dataset #48524
Closed
1 of 3 tasks
Labels
Enhancement
IO Data
IO issues that don't fit into a more specific label
Needs Discussion
Requires discussion from core team before further action
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
I wish I could use pandas to create TensorFlow datasets
Feature Description
Add a new method to_tf_dataset to DataFrame, specifying columns to use as features and labels.
def to_tf_dataset(feature_columns: list[str], label_column: str) -> tf.data.Dataset:
"""
Params:
feature_columns: list[str]: A list of columns to use as features for the dataset
label_column: The column to use as the label for the dataset. Numeric columns will be used as is. Non numeric columns will be converted to pd.Categorical
"""
Alternative Solutions
Manual conversion using tf.data.Dataset.from_tensor_slices
Additional Context
No response
The text was updated successfully, but these errors were encountered: