我正在尝试将数据框转换为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)
我尝试将数组更改为Tensor,但它抛出了错误:
无法转换numpy.object_类型的np.ndarray。仅支持以下类型:float64,float32,float16,complex64,complex128,int64,int32,int16
1条答案
按热度按时间xyhw6mcr1#
因为你有很多字符串变量。你不能把字符串引入神经网络。你需要先把它们转换成数字。