I have two variables that i want to perform on them elementwise logical operations. however I get the following error:
tp = sum(actual & predicted)
TypeError: ufunc 'bitwise_and' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Below is my code:
import pandas as pd
import numpy as np
train = 'train.tsv'
submission = 'submission1234.csv'
trainSearchStream = pd.read_csv(train,sep='\t')
sample = pd.read_csv(path + 'sampleSubmission.csv')
preds = np.array(pd.read_csv(submission, header = None))
index = sample.ID.values - 1
sample['IsClick'] = preds[index]
actual = np.array(trainSearchStream['IsClick'].dropna())
predicted = np.array(sample['IsClick'])
tp = sum(actual & predicted)