Combine Two Text Columns of pandas DataFrame in Python (Example) | Join, Merge & Append Variables
Автор: Statistics Globe
Загружено: 2023-01-23
Просмотров: 237
Описание:
How to join text in columns of a pandas DataFrame in the Python programming language. More details: https://statisticsglobe.com/combine-t...
Python code of this video:
import pandas as pd # Load pandas
data = pd.DataFrame({'x1':['a', 'b', 'c', 'd', 'e'], # Create example DataFrame
'x2':['A', 'B', 'C', 'D', 'E']})
print(data) # Print example DataFrame
data_new = data.copy() # Create copy of DataFrame
data_new['new'] = data_new['x1'] + data_new['x2'] # Concatenate columns
print(data_new) # Print updated DataFrame
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
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: