Python 熊猫:不打印数据类型信息

Python 熊猫:不打印数据类型信息,python,pandas,Python,Pandas,我有预测。iloc[5]: (predictions.iloc[5]) Out[102]: 0 569.366922 Name: 5, dtype: float64 我还有mape mape Out[103]: 3.1396327381728257 我正在将这两个变量组合成forecast forecast = ((predictions.iloc[5]), mape) 我试图在打印时不使用名称:5,数据类型:float64详细信息 但当我尝试时: print(forecast.t

我有
预测。iloc[5]

(predictions.iloc[5])
Out[102]: 
0    569.366922
Name: 5, dtype: float64
我还有
mape

mape
Out[103]: 3.1396327381728257
我正在将这两个变量组合成
forecast

forecast = ((predictions.iloc[5]), mape)
我试图在打印时不使用
名称:5,数据类型:float64
详细信息

但当我尝试时:

print(forecast.to_string(index=False, header=False))
我得到一个错误:

AttributeError: 'tuple' object has no attribute 'to_string'

您可以尝试使用
.values[0]
iloc

forecast = ((predictions.iloc[5].values[0]), mape)
或者通过在预测之前添加
*
来使用解包。iloc[0]:

forecast = (*predictions.iloc[0], mape)
然后,您只需通过以下方式进行打印:

print(*forecast, sep=' ')

谢谢,使用forecast=((predictions.iloc[5].values[0]),mape)然后使用print(forecast.to_string(index=False,header=False))返回AttributeError:“tuple”对象没有属性“to_string”,我想你可以简单地使用
print(*forecast,sep='')
,而不用
to_string