I am new Python Programmer. I want to solve this problem,
series1 = pd.Series([1,2,3,4,5])
series2 = pd.Series([1,3,3,4,6])
data1 = pd.DataFrame([series1,series2])
data_frame = pd.DataFrame(index=[], columns=['column1', 'column2'])
data_frame['column1'] = series1
data_frame['column2'] = series2
There are two columns, column1, column2. And I want to judge from these two columns to see
I tried these code below. But, It doesn't work. Please give me the advice?
judgeList = []
def judgeBool(x):
judgeList.append(x)
if len(judgeList) == 2:
if judgeList[0] == judgeList[1]:
series = pd.Series([True])
data_frame = data_frame.append(series, ignore_index = True)
else:
series = pd.Series([False])
data_frame = data_frame.append(series, ignore_index = True)
data_frame.apply(lambda x: judgeBool(x), axis = 1)