AttributeError: 'int' object has no attribute 'encode'
when i run the following code from the what-if-notebook tool:
#@title Convert dataset to tf.Example protos {display-mode: "form"} examples = df_to_examples(df)
I get the folowing error
AttributeError Traceback (most recent call last)
AttributeError: 'int' object has no attribute 'encode'
@jasonachonu Was this with the https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/interactive_inference/What_If_Tool_Notebook_Usage.ipynb notebook with no changes? Or did you try a different dataset? If so, which one?
I'm not seeing this error in the notebook at HEAD myself.
@jameswex Thanks for your reply. I used the same dataset and the same code. I did not alter anything. I only git clone the repo and tried to run it, then it gave that error.
Can you add code to print the following values before the error occurs: col, df[col].dtype, row[col] Also assuming you are running this in a jupyter notebook, what version of python and jupyter are you using? Thanks.
Hi, I have the same issue. I am running Python 3.6.5 and running Jupyter Lab. Also, tried a different dataset on top of this one and gave me the same error.
Thanks @MortezaMoghadd , can you add code to print the following values before the error occurs: col, df[col].dtype, row[col]?
@jameswex Just to make sure I got it right, you mean that you would like to see the df's type, columns types, etc? Would u mind sharing the exact code so I can use the one you would like to see?
Something like this to help debug when the failure occurs (I haven't tested this code):
def df_to_examples(df, columns=None):
examples = []
if columns == None:
columns = df.columns.values.tolist()
for index, row in df.iterrows():
example = tf.train.Example()
for col in columns:
print(col)
print(df[col].dtype)
if df[col].dtype is np.dtype(np.int64):
example.features.feature[col].int64_list.value.append(int(row[col]))
elif df[col].dtype is np.dtype(np.float64):
example.features.feature[col].float_list.value.append(row[col])
elif row[col] == row[col]:
print row[col]
example.features.feature[col].bytes_list.value.append(row[col].encode('utf-8'))
examples.append(example)
return examples
I just ran this one:
def df_to_examples(df, columns=None):
examples = []
if columns == None:
columns = df.columns.values.tolist()
for index, row in df.iterrows():
example = tf.train.Example()
for col in columns:
print(col)
print(df[col].dtype)
if df[col].dtype is np.dtype(np.int64): example.features.feature[col].int64_list.value.append(int(row[col]))
elif df[col].dtype is np.dtype(np.float64): example.features.feature[col].float_list.value.append(row[col])
elif row[col] == row[col]:
print(row[col])
example.features.feature[col].bytes_list.value.append(row[col].encode('utf-8'))
examples.append(example)
return examples
Got this for my dataset: ID int64 Target_Var int32 Account Group object Age Band EDA object Sum Asset Band Clean 2 object Market object Years As Client Clean Band 2 object Had Loan object Contributing object Web Login 6M object Total Daily Calls 6M (group) object Phone Email Chg Before object Orange Money object Active Directory Reg Before object Age (Voc2017 Matched Demog 22) float64 Log_Sum Balance float64 Max Yr As Client Final float64 Satisfaction int64 Is Transitioner object Signed Edelivery object Enrolled Manage Accnt object Gender object Plan Auto Increase Final object App Login 6M object Loan Issue Before object Wtd Term Before object Fund Transfer Before object Web Logins Group object Total Logins int64 Is Tem object Num Plan Nzf Band object Is First Time Appuser object Is First Time Caller object Is First Time Webuser object Bank Chg Before object Had Rollover object Wtd Mindist Before object Full Surrender Final object NO
I see one column has dtype int32, but the df_to_examples method only handles int64s or float64s (all other types it assumes are strings). Can you try changing the first if statement in the inner for loop to:
if df[col].dtype is np.dtype(np.int64) or df[col].dtype is np.dtype(np.int32):
After running the previous code and this one I don't get that error anymore. However, running
classifier.train(train_inpf, steps=num_steps)
I am getting this error
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners) 352 353 saving_listeners = _check_listeners_type(saving_listeners) --> 354 loss = self._train_model(input_fn, hooks, saving_listeners) 355 logging.info('Loss for final step: %s.', loss) 356 return self
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py in _train_model(self, input_fn, hooks, saving_listeners) 1205 return self._train_model_distributed(input_fn, hooks, saving_listeners) 1206 else: -> 1207 return self._train_model_default(input_fn, hooks, saving_listeners) 1208 1209 def _train_model_default(self, input_fn, hooks, saving_listeners):
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners) 1232 features, labels, input_hooks = ( 1233 self._get_features_and_labels_from_input_fn( -> 1234 input_fn, model_fn_lib.ModeKeys.TRAIN)) 1235 worker_hooks.extend(input_hooks) 1236 estimator_spec = self._call_model_fn(
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py in _get_features_and_labels_from_input_fn(self, input_fn, mode)
1073 """Extracts the features and labels from return values of input_fn."""
1074 return estimator_util.parse_input_fn_result(
-> 1075 self._call_input_fn(input_fn, mode))
1076
1077 def _extract_batch_length(self, preds_evaluated):
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\estimator\estimator.py in _call_input_fn(self, input_fn, mode) 1160 kwargs['config'] = self.config 1161 with ops.device('/cpu:0'): -> 1162 return input_fn(**kwargs) 1163 1164 def _call_model_fn(self, features, labels, mode, config):
AttributeError: module 'tensorflow._api.v1.dtypes' has no attribute 'string'`
My target variable is string but not sure why I am seeing this.
What version of tensorflow do you have installed? I'm not familiar with this error.
One thing to try is to have an environment where you haven't installed witwidget and attempt to train the same model from that notebook to see if the installation of witwidget had an adverse effect on your tensorflow installation.
Closing this as it is in "awaiting response" status for long time. Feel free to add your comments(if any) and we will reopen. Thanks!
I see one column has dtype int32, but the df_to_examples method only handles int64s or float64s (all other types it assumes are strings). Can you try changing the first if statement in the inner for loop to:
if df[col].dtype is np.dtype(np.int64) or df[col].dtype is np.dtype(np.int32):
I was facing similar issues and after making this change, it worked fine.
Now when I run the below code:
num_steps = 5000
# Create a feature spec for the classifier
feature_spec = create_feature_spec(df, features_and_labels)
# Define and train the classifier
train_inpf = functools.partial(tfexamples_input_fn, examples, feature_spec, label_column)
classifier = tf.estimator.LinearClassifier(
feature_columns=create_feature_columns(input_features, feature_spec))
classifier.train(train_inpf, steps=num_steps)
I get this error as follows:
UnimplementedError Traceback (most recent call last)
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
1355 try:
-> 1356 return fn(*args)
1357 except errors.OpError as e:
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
1340 return self._call_tf_sessionrun(
-> 1341 options, feed_dict, fetch_list, target_list, run_metadata)
1342
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
1428 self._session, options, feed_dict, fetch_list, target_list,
-> 1429 run_metadata)
1430
UnimplementedError: Cast string to float is not supported
[[{{node linear/head/ToFloat}}]]
During handling of the above exception, another exception occurred:
UnimplementedError Traceback (most recent call last)
<ipython-input-12-680c5603e8d4> in <module>()
8 classifier = tf.estimator.LinearClassifier(
9 feature_columns=create_feature_columns(input_features, feature_spec))
---> 10 classifier.train(train_inpf, steps=num_steps)
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
365
366 saving_listeners = _check_listeners_type(saving_listeners)
--> 367 loss = self._train_model(input_fn, hooks, saving_listeners)
368 logging.info('Loss for final step: %s.', loss)
369 return self
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model(self, input_fn, hooks, saving_listeners)
1156 return self._train_model_distributed(input_fn, hooks, saving_listeners)
1157 else:
-> 1158 return self._train_model_default(input_fn, hooks, saving_listeners)
1159
1160 def _train_model_default(self, input_fn, hooks, saving_listeners):
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners)
1190 return self._train_with_estimator_spec(estimator_spec, worker_hooks,
1191 hooks, global_step_tensor,
-> 1192 saving_listeners)
1193
1194 def _train_model_distributed(self, input_fn, hooks, saving_listeners):
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py in _train_with_estimator_spec(self, estimator_spec, worker_hooks, hooks, global_step_tensor, saving_listeners)
1482 any_step_done = False
1483 while not mon_sess.should_stop():
-> 1484 _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
1485 any_step_done = True
1486 if not any_step_done:
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
752 feed_dict=feed_dict,
753 options=options,
--> 754 run_metadata=run_metadata)
755
756 def run_step_fn(self, step_fn):
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
1250 feed_dict=feed_dict,
1251 options=options,
-> 1252 run_metadata=run_metadata)
1253 except _PREEMPTION_ERRORS as e:
1254 logging.info(
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, *args, **kwargs)
1351 raise six.reraise(*original_exc_info)
1352 else:
-> 1353 raise six.reraise(*original_exc_info)
1354
1355
d:\workspace\pythonenvs\neuralnets\lib\site-packages\six.py in reraise(tp, value, tb)
691 if value.__traceback__ is not tb:
692 raise value.with_traceback(tb)
--> 693 raise value
694 finally:
695 value = None
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, *args, **kwargs)
1336 def run(self, *args, **kwargs):
1337 try:
-> 1338 return self._sess.run(*args, **kwargs)
1339 except _PREEMPTION_ERRORS:
1340 raise
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, fetches, feed_dict, options, run_metadata)
1409 feed_dict=feed_dict,
1410 options=options,
-> 1411 run_metadata=run_metadata)
1412
1413 for hook in self._hooks:
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\training\monitored_session.py in run(self, *args, **kwargs)
1167
1168 def run(self, *args, **kwargs):
-> 1169 return self._sess.run(*args, **kwargs)
1170
1171 def run_step_fn(self, step_fn, raw_session, run_with_hooks):
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
948 try:
949 result = self._run(None, fetches, feed_dict, options_ptr,
--> 950 run_metadata_ptr)
951 if run_metadata:
952 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1171 if final_fetches or final_targets or (handle and feed_dict_tensor):
1172 results = self._do_run(handle, final_targets, final_fetches,
-> 1173 feed_dict_tensor, options, run_metadata)
1174 else:
1175 results = []
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
1348 if handle is None:
1349 return self._do_call(_run_fn, feeds, fetches, targets, options,
-> 1350 run_metadata)
1351 else:
1352 return self._do_call(_prun_fn, handle, feeds, fetches)
d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args)
1368 pass
1369 message = error_interpolation.interpolate(message, self._graph)
-> 1370 raise type(e)(node_def, op, message)
1371
1372 def _extend_graph(self):
UnimplementedError: Cast string to float is not supported
[[node linear/head/ToFloat (defined at <ipython-input-12-680c5603e8d4>:10) ]]
Original stack trace for 'linear/head/ToFloat':
File "c:\python36\Lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python36\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\kernelapp.py", line 497, in start
self.io_loop.start()
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tornado\platform\asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "c:\python36\Lib\asyncio\base_events.py", line 421, in run_forever
self._run_once()
File "c:\python36\Lib\asyncio\base_events.py", line 1431, in _run_once
handle._run()
File "c:\python36\Lib\asyncio\events.py", line 145, in _run
self._callback(*self._args)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tornado\platform\asyncio.py", line 122, in _handle_events
handler_func(fileobj, events)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tornado\stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events
self._handle_recv()
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
self._run_callback(callback, msg)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tornado\stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\kernelbase.py", line 233, in dispatch_shell
handler(stream, idents, msg)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\ipkernel.py", line 208, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\ipykernel\zmqshell.py", line 537, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\IPython\core\interactiveshell.py", line 2662, in run_cell
raw_cell, store_history, silent, shell_futures)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\IPython\core\interactiveshell.py", line 2785, in _run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\IPython\core\interactiveshell.py", line 2907, in run_ast_nodes
if self.run_code(code, result):
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\IPython\core\interactiveshell.py", line 2961, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-12-680c5603e8d4>", line 10, in <module>
classifier.train(train_inpf, steps=num_steps)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 367, in train
loss = self._train_model(input_fn, hooks, saving_listeners)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1158, in _train_model
return self._train_model_default(input_fn, hooks, saving_listeners)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1188, in _train_model_default
features, labels, ModeKeys.TRAIN, self.config)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1146, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\canned\linear.py", line 991, in _model_fn
sparse_combiner=sparse_combiner)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\canned\linear.py", line 755, in _linear_model_fn
logits=logits)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\canned\head.py", line 241, in create_estimator_spec
regularization_losses))
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\canned\head.py", line 1242, in _create_tpu_estimator_spec
features=features, mode=mode, logits=logits, labels=labels))
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow_estimator\python\estimator\canned\head.py", line 1143, in create_loss
labels = math_ops.to_float(labels)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\ops\math_ops.py", line 744, in to_float
return cast(x, dtypes.float32, name=name)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\util\dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\ops\math_ops.py", line 689, in cast
x = gen_math_ops.cast(x, base_type, name=name)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 2346, in cast
"Cast", x=x, DstT=DstT, Truncate=Truncate, name=name)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
op_def=op_def)
File "d:\workspace\pythonenvs\neuralnets\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
self._traceback = tf_stack.extract_stack()
@tonysinghmss which notebook is this with? One of the ones provided? Or your own dataset/model. And can you provide details about your environment (TF version, witwidget version, python version, etc.). Thanks!
This is the notebook that trains a linear classifier on the UCI census problem. I am working with Python 3.6.4, Tensorflow 1.14.0 and witwidget 1.2
@tonysinghmss can you paste what the feature_spec and df.dtypes variables both contain? Thanks.
df.dtypes is :
Age int64
Workclass object
fnlwgt int64
Education object
Education-Num int64
Marital-Status object
Occupation object
Relationship object
Race object
Sex object
Capital-Gain int64
Capital-Loss int64
Hours-per-week int64
Country object
Over-50K int32
dtype: object
feature_spec is:
{'Age': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Workclass': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Education': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Marital-Status': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Occupation': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Relationship': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Race': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Sex': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Capital-Gain': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Capital-Loss': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Hours-per-week': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Country': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Over-50K': FixedLenFeature(shape=(), dtype=tf.string, default_value=None)}
df.dtypes is :
Age int64
Workclass object
fnlwgt int64
Education object
Education-Num int64
Marital-Status object
Occupation object
Relationship object
Race object
Sex object
Capital-Gain int64
Capital-Loss int64
Hours-per-week int64
Country object
Over-50K int32
dtype: object
feature_spec is:
{'Age': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Workclass': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Education': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Marital-Status': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Occupation': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Relationship': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Race': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Sex': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Capital-Gain': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Capital-Loss': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Hours-per-week': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Country': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Over-50K': FixedLenFeature(shape=(), dtype=tf.string, default_value=None)}
df.dtypes is :
Age int64
Workclass object
fnlwgt int64
Education object
Education-Num int64
Marital-Status object
Occupation object
Relationship object
Race object
Sex object
Capital-Gain int64
Capital-Loss int64
Hours-per-week int64
Country object
Over-50K int32
dtype: object
feature_spec is: ` {'Age': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Workclass': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Education': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Marital-Status': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Occupation': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Relationship': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Race': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Sex': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Capital-Gain': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Capital-Loss': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Hours-per-week': FixedLenFeature(shape=(), dtype=tf.int64, default_value=None), 'Country': FixedLenFeature(shape=(), dtype=tf.string, default_value=None), 'Over-50K': FixedLenFeature(shape=(), dtype=tf.string, default_value=None)}
`
df.dtypes is :
Age int64
Workclass object
fnlwgt int64
Education object
Education-Num int64
Marital-Status object
Occupation object
Relationship object
Race object
Sex object
Capital-Gain int64
Capital-Loss int64
Hours-per-week int64
Country object
Over-50K int32
dtype: object