Find Differences Between Two Columns of pandas DataFrame in Python (3 Examples) | equals() Function

preview_player
Показать описание
Python code of this video:

import pandas as pd # Load pandas

data = pd.DataFrame({'x1':[1, 3, 2, 4, 7, 5], # Create first pandas DataFrame
'x2':['a', 'b', 'c', 'd', 'e', 'f'],
'x3':range(1, 7)})
print(data) # Print first pandas DataFrame

print(data['x1'].equals(data['x3'])) # Apply equals function
# False

print(data['x1'] == data['x3']) # Apply logical operator
# 0 True
# 1 False
# 2 False
# 3 True
# 4 False
# 5 False
# dtype: bool

print(data['x1'].isin(data['x3'])) # Apply isin function
# 0 True
# 1 True
# 2 True
# 3 True
# 4 False
# 5 True
# Name: x1, dtype: bool

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

how to print exact values of Boolean, like if we got false then which value is not match that i want to print, how to print original data frame values

a_infinite
Автор

2 excel file
1st excel file name reference and 2nd excel file name verify
Reference file heading tag, command, time sane as verify fike heading. Reference file tag: syn and command:command on and time 5 and verify file tag and command same and 5 times if tag snd comment same means print time different (verify file time- reference file time) one by one print the results please help me this logic solution

anshamma.m