How to Concatenate Column Values in Pandas DataFrame? Last Updated : 10 Jul, 2020 Comments Improve Suggest changes Like Article Like Report Many times we need to combine values in different columns into a single column. There can be many use cases of this, like combining first and last names of people in a list, combining day, month, and year into a single column of Date, etc. Now we'll see how we can achieve this with the help of some examples. Example 1: In this example, we'll combine two columns of first name last name to a column name. To achieve this we'll use the map function. Python3 1== import pandas as pd from pandas import DataFrame # creating a dictionary of names Names = {'FirstName':['Suzie','Emily','Mike','Robert'], 'LastName':['Bates','Edwards','Curry','Frost']} # creating a dataframe from dictionary df = DataFrame(Names, columns=['FirstName','LastName']) print(df) print('\n') # concatenating the columns df['Name'] = df['FirstName'].map(str) + ' ' + df['LastName'].map(str) print(df) Output: Example 2: Similarly, we can concatenate any number of columns in a dataframe. Let's see through another example to concatenate three different columns of the day, month, and year in a single column Date. Python3 1== import pandas as pd from pandas import DataFrame # creating a dictionary of Dates Dates = {'Day': [1, 29, 23, 4, 15], 'Month': ['Aug', 'Feb', 'Aug', 'Apr', 'Mar'], 'Year': [1947, 1983, 2007, 2011, 2020]} # creating a dataframe from dictionary df = DataFrame(Dates, columns = ['Day', 'Month', 'Year']) print (df) print('\n') # concatenating the columns df['Date'] = df['Day'].map(str) + '-' + df['Month'].map(str) + '-' + df['Year'].map(str) print (df) Output: Example 3: We can take this process further and concatenate multiple columns from multiple different dataframes. In this example, we combine columns of dataframe df1 and df2 into a single dataframe. Python3 1== import pandas as pd from pandas import DataFrame # creating a dictionary of Dates Dates = {'Day': [1, 1, 1, 1], 'Month': ['Jan', 'Jan', 'Jan', 'Jan'], 'Year': [2017, 2018, 2019, 2020]} # creating a dataframe from dictionary df1 = DataFrame(Dates, columns = ['Day', 'Month', 'Year']) # creating a dictionary of Rates Rates = {'GDP': [5.8, 7.6, 5.6, 4.1], 'Inflation Rate': [2.49, 4.85, 7.66, 6.08]} # creating a dataframe from dictionary df2 = DataFrame(Rates, columns = ['GDP', 'Inflation Rate']) # combining columns of df1 and df2 df_combined = df1['Day'].map(str) + '-' + df1['Month'].map(str) + '-' + df1['Year'].map(str) + ': ' + 'GDP: ' + df2['GDP'].map(str) + '; ' + 'Inflation: ' + df2['Inflation Rate'].map(str) print (df_combined) Output: Comment More infoAdvertise with us Next Article How to Concatenate Column Values in Pandas DataFrame? P parasmadan15 Follow Improve Article Tags : Python Python-pandas Python pandas-dataFrame Practice Tags : python Similar Reads Concatenate two columns of Pandas dataframe Let's discuss how to Concatenate two columns of dataframe in pandas python. We can do this by using the following functions : concat() append() join() Example 1 : Using the concat() method. Python3 1== # importing the module import pandas as pd # creating 2 DataFrames location = pd.DataFrame({'area' 2 min read How to Convert Index to Column in Pandas Dataframe? Pandas is a powerful tool which is used for data analysis and is built on top of the python library. The Pandas library enables users to create and manipulate dataframes (Tables of data) and time series effectively and efficiently. These dataframes can be used for training and testing machine learni 2 min read Add column with constant value to pandas dataframe Prerequisite: Pandas In this article, we will learn how to add a new column with constant value to a Pandas DataFrame. Before that one must be familiar with the following concepts: Pandas DataFrame : Pandas DataFrame is two-dimensional size-mutable, potentially heterogeneous tabular arrangement wit 2 min read How To Concatenate Two or More Pandas DataFrames? In real-world data the information is often spread across multiple tables or files. To analyze it properly we need to bring all that data together. This is where the pd.concat() function in Pandas comes as it allows you to combine two or more DataFrames in: Vertically (stacking rows on top of each o 3 min read How to combine two DataFrames in Pandas? While working with data, there are multiple times when you would need to combine data from multiple sources. For example, you may have one DataFrame that contains information about a customer, while another DataFrame contains data about their transaction history. If you want to analyze this data tog 3 min read Like