I have a pandas dataframe like
data = [[0, 10, 22000, 3],
[1, 15, 42135, 4],
[0, 14, 13526, 5],
[0, 16, 32156, 3],
[1, 23, 13889, 5],
[0, 18, 18000, 6],
[0, 21, 13189, 2],
[1, 32, 58766, 2]]
df = pd.DataFrame(data, columns = ['Gender', 'Age', 'Amount','Dependents'])
And I have a numpy array
arr = numpy.array([[1, 15, 42135, 4],
[1, 23, 13889, 5],
[0, 21, 13189, 2]])
Here I would like to create a new column in the dataframe 'data'(say 'Good_Bad') with 1 if the array present in data.
The result should be like
data = [[0, 10, 22000, 3, 0],
[1, 15, 42135, 4, 1],
[0, 14, 13526, 5, 0],
[0, 16, 32156, 3, 0],
[1, 23, 13889, 5, 1],
[0, 18, 18000, 6, 0],
[0, 21, 13189, 2, 1],
[1, 32, 58766, 2, 0]]
The records 2,5,7 has 1 in the new column and other records have 0. Not sure how to map array and dataframe.