Skip to content

Instantly share code, notes, and snippets.

@BryanCutler
Last active August 5, 2019 19:34
Show Gist options
  • Save BryanCutler/2a5fcba999aef34df347b18c2cf8f6f1 to your computer and use it in GitHub Desktop.
Save BryanCutler/2a5fcba999aef34df347b18c2cf8f6f1 to your computer and use it in GitHub Desktop.
TensorFlow Arrow Blog Part 2 - ArrowDataset
import tensorflow_io.arrow as arrow_io
ds = arrow_io.ArrowDataset.from_pandas(
df,
batch_size=2,
preserve_index=False)
# Make an iterator to the dataset
ds_iter = iter(ds)
# Print the first batch
print(next(ds_iter))
#(<tf.Tensor: id=43, shape=(2, 2), dtype=float64,
# numpy=array([[1.07302346, 1.38554093],
# [-0.8594516, -0.6890264]])>,
# <tf.Tensor: id=44, shape=(2,), dtype=int64,
# numpy=array([1, 0])>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment