樓主小白,最近在處理一個excel機器學習時發現一個問題,用panda匯入并如下以后:
train_x, test_x, train_y, test_y = train_test_split(BOOK['level'], BOOK['target'], train_size=0.7, test_size=0.3, random_state=0)
對其格式處理:
train_x1=torch.FloatTensor(train_x)
沒問題,但是奇怪的來了
test_x = torch.FloatTensor(test_x)出現了以下問題
ValueError: could not determine the shape of object type 'Series'
可是這兩個我print出來都是一模一樣的格式與樣子,test_x的shape和trainx也是3:7,都是(xxxx,)的樣式
而且我把上面0.7,0.3的比例換成0.3,0.7的比例后testx就沒問題了,trainx出現了同樣的問題,多的沒問題,少的有問題,難道還和數目有關嗎?
甚是疑惑,搜也搜不到答案,希望大家知道一下
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/33106.html
標籤:人工智能技術
