#clf1.fit(df.ix[:train_count, :-1], df.ix[:train_count, 'label'],df.ix[train_count:, :-1],df.ix[train_count:, -1],train_count)
#clf1.Get_Cost(df.ix[train_count:, :-1],df.ix[train_count:, -1],train_count)
'''clf1.fit(df.iloc[:train_count, :-1], df.iloc[:train_count, 'label'], df.iloc[train_count:, :-1], df.iloc[train_count:, -1],
train_count)
'''
clf1.fit(df.iloc[:train_count, :-1], df.iloc[:train_count, 'label'], df.iloc[train_count:, :-1],
df.iloc[train_count:, -1], train_count)
Traceback (most recent call last):
File "E:\Software Install\Python3.6\lib\site-packages\pandas\core\indexing.py", line 702, in _has_valid_tuple
self._validate_key(k, i)
File "E:\Software Install\Python3.6\lib\site-packages\pandas\core\indexing.py", line 1369, in _validate_key
raise ValueError(f"Can only index by location with a [{self._valid_types}]")
ValueError: Can only index by location with a [integer, integer slice (START point is INCLUDED, END point is EXCLUDED), listlike of integers, boolean array]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "E:/000信用风险分析/代码/Double-Cost-sensitive-RF-master/自己版本.py", line 411, in
clf1.fit(df.iloc[:train_count, :-1], df.iloc[:train_count, 'label'], df.iloc[train_count:, :-1],
File "E:\Software Install\Python3.6\lib\site-packages\pandas\core\indexing.py", line 873, in getitem
return self._getitem_tuple(key)
File "E:\Software Install\Python3.6\lib\site-packages\pandas\core\indexing.py", line 1443, in _getitem_tuple
self._has_valid_tuple(tup)
File "E:\Software Install\Python3.6\lib\site-packages\pandas\core\indexing.py", line 707, in _has_valid_tuple
) from err
ValueError: Location based indexing can only have [integer, integer slice (START point is INCLUDED, END point is EXCLUDED), listlike of integers, boolean array] types
您好,打扰了,这个问题一直报错,试了好几种方法还是不行,您有空可以帮忙看一下吗?
谢谢!