:2: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray x_train, y_train = np.array(x_train), np.array(y_train)
What does this mean and how can I solve it? This is the code I am running:
#import libraries:
import math
import time
import pandas as pd
import datetime
import numpy as np
import streamlit as st
import matplotlib.pyplot as plt
import pandas_datareader as web
from tensorflow.keras.models import Sequential
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.layers import Dense, Dropout, LSTM
plt.style.use('fivethirtyeight')
import tensorflow.compat.v2 as tf
#Scale the data:
scaler = MinMaxScaler(feature_range=(0,1))
scaled_data = scaler.fit_transform(dataset)
scaled_data
#Create the training dataset:
#Create the scaled training dataset:
train_data = scaled_data[0:training_data_len, :]
#Split the data into x_train and y_train datasets:
x_train = []
y_train = []
for i in range(60, len(train_data)):
x_train.append(train_data[i-60:, 0])
y_train.append(train_data[1,0])
if i <= 61:
print(x_train)
print(y_train)
print()
#Convert the x_train and y_train to numpy arrays:
x_train, y_train = np.array(x_train), np.array(y_train)