How to compare two columns of a pandas DataFrame in the Python programming language. More details: https://statisticsglobe.com/find-diff...
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:
Facebook – Statistics Globe Page: / statisticsglobecom
Facebook – R Programming Group for Discussions & Questions: / statisticsglobe
Facebook – Python Programming Group for Discussions & Questions: / statisticsglobepython
LinkedIn – Statistics Globe Page: / statisticsglobe
LinkedIn – R Programming Group for Discussions & Questions: / 12555223
LinkedIn – Python Programming Group for Discussions & Questions: / 12673534
Twitter: / joachimschork
Music by bensound.com
На этой странице сайта вы можете посмотреть видео онлайн Find Differences Between Two Columns of pandas DataFrame in Python (3 Examples) | equals() Function длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Statistics Globe 24 Август 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 2,766 раз и оно понравилось 23 зрителям. Приятного просмотра!