TypeError: Signature mismatch. Keys must be dtype <dtype: 'string'>, got <dtype:'int64'>
<p>While running the wide_n_deep_tutorial program from TensorFlow <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py" rel="nofollow">https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py</a> on my dataset, the following error is displayed.</p>

<pre><code>"TypeError: Signature mismatch. Keys must be dtype &lt;dtype: 'string'&gt;, got &lt;dtype:'int64'&gt;"
</code></pre>

<p><a href="http://i.stack.imgur.com/aqs3x.png" rel="nofollow">enter image description here</a></p>

<p>Following is the code snippet:</p>

<pre><code> def input_fn(df):
  """Input builder function."""
  # Creates a dictionary mapping from each continuous feature column name (k) to
  # the values of that column stored in a constant Tensor.
  continuous_cols = {k: tf.constant(df[k].values) for k in CONTINUOUS_COLUMNS}
  # Creates a dictionary mapping from each categorical feature column name (k)
  # to the values of that column stored in a tf.SparseTensor.
  categorical_cols = {k: tf.SparseTensor(
      indices=[[i, 0] for i in range(df[k].size)],
      values=df[k].values,
      shape=[df[k].size, 1])
                      for k in CATEGORICAL_COLUMNS}

  # Merges the two dictionaries into one.
  feature_cols = dict(continuous_cols)
  feature_cols.update(categorical_cols)
  # Converts the label column into a constant Tensor.
  label = tf.constant(df[LABEL_COLUMN].values)
  # Returns the feature columns and the label.

  return feature_cols, label



def train_and_eval():
  """Train and evaluate the model."""
  train_file_name, test_file_name = maybe_download()

  df_train=train_file_name
  df_test=test_file_name

  df_train[LABEL_COLUMN] = (
      df_train["impression_flag"].apply(lambda x: "generated" in x)).astype(str)

  df_test[LABEL_COLUMN] = (
      df_test["impression_flag"].apply(lambda x: "generated" in x)).astype(str)

  model_dir = tempfile.mkdtemp() if not FLAGS.model_dir else FLAGS.model_dir
  print("model directory = %s" % model_dir)

  m = build_estimator(model_dir)
  print('model succesfully build!')
  m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps)
  print('model fitted!!')
  results = m.evaluate(input_fn=lambda: input_fn(df_test), steps=1)
  for key in sorted(results):
    print("%s: %s" % (key, results[key]))
</code></pre>

<p>Any help is appreciated.</p>

<p>would help to see the output prior to the error message to determine which part of the process this error tripped out at, but, the message says quite clearly that the key is expected to be a string whereas an integer was given instead. I am only guessing, but are the column names set out correctly in the earlier part of your script as they could potentially be the keys that are being referred to in this instance?</p>

python pandas tensorflow