Merge pull request #24853 from joyalbin:make_csv_NAvalue_delim

PiperOrigin-RevId: 230810097
This commit is contained in:
TensorFlower Gardener 2019-01-24 16:27:45 -08:00
commit f45678023c

View File

@ -449,6 +449,28 @@ class MakeCsvDatasetTest(test_base.DatasetTestBase):
header=True,
)
def testMakeCSVDataset_withNAValuesAndFieldDelim(self):
"""Tests that datasets can be created from different delim and na_value."""
column_names = ["col%d" % i for i in range(5)]
inputs = [["0 1 2 3 4", "5 6 7 8 9"], ["10 11 12 13 14", "15 16 17 ? 19"]]
expected_output = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14],
[15, 16, 17, 0, 19]]
label = "col0"
self._test_dataset(
inputs,
expected_output=expected_output,
expected_keys=column_names,
column_names=column_names,
label_name=label,
batch_size=1,
num_epochs=1,
shuffle=False,
header=False,
na_value="?",
field_delim=" ",
)
def testMakeCSVDataset_withSelectCols(self):
record_defaults = [
constant_op.constant([], dtypes.int32),