【发布时间】:2017-06-21 10:08:51
【问题描述】:
frame = []
for i in range(1,21):
frame.append(sampler(i))
# sampler is a function which return an array of 764*36
header = ['Act_High', 'Act_Low', 'Act_Avg', 'Precip_Amt', 'Festival_Impact',
'Val_Share', 'Variable_Disc___ValueOff__Rs',
'Non_Discounted_Gross_Revenue__Rs__', 'Fixed_Disc___ValueOff__Rs',
'Total_Volume__No__', 'unitMrp', 'Variable_Disc___PerOff__Rs',
'Fixed_Disc___FOC__Rs', 'Variable_Disc___FOC__Rs',
'Fixed_Disc___PerOff__Rs', 'Total_Volume__No__rmean',
'Non_Discounted_Gross_Revenue__Rs__rmean', 'Total_Volume__No__rmax',
'Non_Discounted_Gross_Revenue__Rs__rmax', 'Total_Volume__No__rmin',
'Non_Discounted_Gross_Revenue__Rs__rmin', 'Total_Volume__No__rstd',
'Non_Discounted_Gross_Revenue__Rs__rstd', 'Total_Volume__No__rymean',
'Non_Discounted_Gross_Revenue__Rs__rymean', 'Apr', 'Aug', 'Dec',
'Feb', 'Jan', 'Jul', 'Jun', 'Mar', 'May', 'Nov', 'Oct', 'Sep']
frame = np.nan_to_num(frame)
frame = pd.DataFrame(frame, columns = header)
ValueError: Shape of passed values is (1, 20), indices imply (37, 20)
【问题讨论】:
-
采样器是做什么的?
-
sampler 确实能做到你认为的那样吗? for 循环后的框架是什么样的?
-
sampler(1).shape -> (767, 37)
-
问题是我认为它正在创建 3d 数组,我需要将其转换为 2d .. 但我不知道该怎么做
标签: python scikit-learn xgboost