Mustafa Faris
Mustafa Faris

Reputation: 1

can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16

I'm trying to convert my data frame to a tensor.

df_1 = pd.read_csv(r'data/flight_data_set/flight.csv',
                   usecols= ['Airline name ', 'Travel  Time' ,'Number of  Stoppage ', 'Depreture  Airport', 'Depreture Time', '1st Stoppage Waiting Hour', '1st Stoppage', '2nd StoppageWaiting Time'])

train_x = torch.tensor(df_1.values)

I tried to change the array to a tensor, but it threw the error :

can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16

Upvotes: 0

Views: 150

Answers (1)

TheEngineerProgrammer
TheEngineerProgrammer

Reputation: 1461

Because you have many string variables. You cant introduce strings to a NN. You need to tranform them to numbers first.

Upvotes: 0

Related Questions