推 goldflower: pd.read_csv(..., sep=' ', ...) 04/07 22:22
→ worthy0429: gold大,我有試過這個了這樣子df的shape會變成(20000 04/07 22:35
→ worthy0429: ,1)耶 04/07 22:35
推 goldflower: 那可能是用tab分的吧 sep='\t' 看看 04/07 23:27
→ goldflower: 還不行你就傳個前幾行的版本上來看看 04/07 23:28
推 hguan: 試試看這個方法dataset = pd.read_csv('train.csv') 04/07 23:38
→ hguan: xdata = dataset['feature'] 04/07 23:38
→ hguan: xdata = pd.DataFrame(xdata.str.split(' ').tolist()) 04/07 23:38
→ hguan: xdata = xdata.reshape(-1,48,48) 04/07 23:40
→ worthy0429: gold大還是不行 你是只程式前幾行嗎 04/07 23:59
→ worthy0429: 'StringMethods' object has no attribute 'spilt' 04/08 00:01
→ worthy0429: 我正在找原因 04/08 00:01
→ worthy0429: h大用你的方法會xdata.shape會變成(20000,2304)! 04/08 00:18
→ worthy0429: 但是會出現df沒有reshape的功能,於是我加了一行 04/08 00:19
→ worthy0429: xdata=xdata.as_matrix()就可以了! 看起來是成功了 04/08 00:25
→ worthy0429: 非常謝謝我估狗了很久都沒有解決QQ 04/08 00:25
推 sean50301: 同學你修ML的嗎XD 04/08 12:01
→ sean50301: xdata.map(lambda x: x.split(‘ ‘)) 04/08 12:02
→ sean50301: 直接貼好了 懶得打 04/08 12:09
→ sean50301: 關鍵是要tolist再重新建ndarray 04/08 12:10
→ worthy0429: sean大謝謝我現在人在外面回去用你的方式試試看!!我 04/08 17:58
→ worthy0429: 是ML初學者在練習題目>< 04/08 17:58
推 fly168: 嘻嘻樓主該不會跟我修同堂課吧XDD 04/09 06:09