我有predictions.iloc[5]:(predictions.iloc[5])Out[102]: 0 569.366922Name: 5, dtype: float64我也有 mapemapeOut[103]: 3.1396327381728257我將兩個變量組合成 forecastforecast = ((predictions.iloc[5]), mape)我試圖在沒有Name: 5, dtype: float64細節的情況下打印但是當我嘗試:print(forecast.to_string(index=False, header=False))我得到錯誤:AttributeError: 'tuple' object has no attribute 'to_string'
1 回答

莫回無
TA貢獻1865條經驗 獲得超7個贊
您可以嘗試.values[0]
使用iloc
:
forecast = ((predictions.iloc[5].values[0]), mape)
或者通過添加*
before 來使用解包predictions.iloc[0]
:
forecast = (*predictions.iloc[0], mape)
然后,您可以簡單地打?。?/p>
print(*forecast, sep=' ')
添加回答
舉報
0/150
提交
取消