I'm new to Keras and I want to fit my train data in an Excel file. My data has shape(1000, 5, 5), 1000 batches of data which are saved in 1000 spreadsheets, each sheet contain 5 columns and rows:
| A | B | C | D | E |
|---|---|---|---|---|
| - | - | - | - | label |
| - | - | - | - | label |
| - | - | - | - | label |
| - | - | - | - | label |
| - | - | - | - | label |
I want Column A, B, C to be training features and Column E to be label.
import pandas as pd
import tensorflow as tf
import multiprocessing
df = pd.read_excel('File.xlsx', sheet_name=None)
data_list = list(df.values())
def input_parser(x):
Y = x.pop('E')
features = ['A','B','C']
X = x[features]
return X, Y
dataset = tf.data.Dataset.from_tensor_slices(data_list)
dataset = dataset.map(lambda x: tuple(tf.py_function(func=input_parser,
inp=[x],
Tout=[tf.float32,tf.int64])),
num_parallel_calls=multiprocessing.cpu_count())
and then I got an error:
ValueError: Can't convert non-rectangular Python sequence to Tensor.
Why do I get this error? How can I fit this data to my model?