Skip to content

Instantly share code, notes, and snippets.

@BryanCutler
Last active August 5, 2019 17:38
Show Gist options
  • Save BryanCutler/8d1532f212345720f9485ee475dc24f0 to your computer and use it in GitHub Desktop.
Save BryanCutler/8d1532f212345720f9485ee475dc24f0 to your computer and use it in GitHub Desktop.
TensorFlow Arrow Blog Part 3 - ArrowFeatherDataset
import tensorflow_io.arrow as arrow_io
from pyarrow.feather import write_feather
# Write the Pandas DataFrame to a Feather file
write_feather(df, '/path/to/df.feather')
# Create the dataset with one or more filenames
ds = arrow_io.ArrowFeatherDataset(
['/path/to/df.feather'],
columns=(0, 1, 2),
output_types=(tf.int64, tf.float64, tf.float64),
output_shapes=([], [], []))
# Iterate over each row of each file
for record in ds:
label, x0, x1 = record
# use label and feature tensors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment