Reputation: 49
I am trying to update the values of a data frame by using:
train.iloc[test_idx][target] = clf.predict(X.iloc[test_idx])
clf.predict() returns a numpy array of the length text_idx. This fails to update the value at train.iloc[test_idx][target] and I do not know why. What also confuses me is that if I do something like train[target] = somenumpyarray
then this works.
Upvotes: 0
Views: 142
Reputation: 40
Try reversing the selectors and select by column first, this should fix the issue.
train.target.iloc[test_idx] = clf.predict(X.iloc[test_idx])
Upvotes: 2