my code :
# %%

import numpy as np
import pandas as pd
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense
from tensorflow.keras.utils import Sequence
from sklearn.preprocessing import MinMaxScaler
import os

# %%
class DataGenerator(Sequence):
    def __init__(self, file_list, batch_size, n_steps=30, scale=True, shuffle=False):
        self.file_list = file_list
        self.batch_size = batch_size
        self.n_steps = n_steps
        self.scale = scale
        self.shuffle = shuffle
        self.scalers = {}

    def __len__(self):
        # Calculate the total number of samples dynamically
        total = 0
        for file in self.file_list:
            df = pd.read_csv(file).drop([
                'Date', 'Symbol',
                'y_High_1d', 'y_Low_1d', 'y_Priority_1d',
                 'y_High_2d', 'y_Low_2d', 'y_Priority_2d',
                  'y_High_3d', 'y_Low_3d', 'y_Priority_3d',
                   'y_High_5d', 'y_Low_5d', 'y_Priority_5d'], axis=1)
            total += df.shape[0] - self.n_steps
        return total // self.batch_size

    def __getitem__(self, idx):
        batch_x = []
        batch_y = []
        for file in self.file_list:
            df = pd.read_csv(file).drop([
                'Date', 'Symbol',
                'y_High_1d', 'y_Low_1d', 'y_Priority_1d',
                 'y_High_2d', 'y_Low_2d', 'y_Priority_2d',
                  'y_High_3d', 'y_Low_3d', 'y_Priority_3d',
                   'y_High_5d', 'y_Low_5d', 'y_Priority_5d'], axis=1)
            if self.scale:
                if file not in self.scalers:
                    scaler = MinMaxScaler(feature_range=(0, 1))
                    self.scalers[file] = scaler.fit(df)
                else:
                    scaler = self.scalers[file]
                df = scaler.transform(df)

            # Generate batches based on the number of steps
            for i in range(self.n_steps, len(df)):
                batch_x.append(df[i-self.n_steps:i].values)
                batch_y.append(df.iloc[i]['y_High_1d'])
                
                if len(batch_x) >= self.batch_size:
                    return np.array(batch_x), np.array(batch_y)
        
        if self.shuffle:
            c = list(zip(batch_x, batch_y))
            np.random.shuffle
            batch_x, batch_y = zip(*c)
            
        return np.array(batch_x), np.array(batch_y)

    def __on_epoch_end__(self):
        if self.shuffle:
            np.random.shuffle(self.file_list)


# %%
def build_model(input_shape):
    model = Sequential()
    model.add(LSTM(units=50, return_sequences=True, input_shape=input_shape))
    # model.add(LSTM(units=50))
    model.add(Dense(1))

    model.compile(optimizer='adam', loss='mean_squared_error')
    
    return model

# %%
data_path =r'F:\day_spot'
file_list = [os.path.join(data_path, f) for f in os.listdir(data_path) if f.endswith('.csv')]

# %%
n_features = 6427
batch_size = 32

# %%
data_gen = DataGenerator(file_list=file_list, batch_size=batch_size, n_steps=30, scale=True, shuffle=False)
model = build_model((30, n_features)) # 30 days look-back, 6427 features

# %%
# Fit the model
model.fit(data_gen, epochs=10)





error:
{
	"name": "AttributeError",
	"message": "'numpy.ndarray' object has no attribute 'values'",
	"stack": "---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 2
      1 # Fit the model
----> 2 model.fit(data_gen, epochs=10)

File c:\\Users\\Fazel\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\keras\\utils\\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

Cell In[2], line 43, in DataGenerator.__getitem__(self, idx)
     41 # Generate batches based on the number of steps
     42 for i in range(self.n_steps, len(df)):
---> 43     batch_x.append(df[i-self.n_steps:i].values)
     44     batch_y.append(df.iloc[i]['y_High_1d'])
     46     if len(batch_x) >= self.batch_size:

AttributeError: 'numpy.ndarray' object has no attribute 'values'"
}