Concatenate two columns of Pandas dataframe Last Updated : 01 Aug, 2020 Comments Improve Suggest changes Like Article Like Report 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': ['new-york', 'columbo', 'mumbai']}) food = pd.DataFrame({'food': ['pizza', 'crabs', 'vada-paw']}) # concatenating the DataFrames det = pd.concat([location, food], join = 'outer', axis = 1) # displaying the DataFrame print(det) Output : Example 2 : Using the append() method. Python3 1== # importing the module import pandas as pd # creating 2 DataFrames first = pd.DataFrame([['one', 1], ['three', 3]], columns =['name', 'word']) second = pd.DataFrame([['two', 2], ['four', 4]], columns =['name', 'word']) # concatenating the DataFrames dt = first.append(second, ignore_index = True) # displaying the DataFrame print(dt) Output : Example 3 : Using the .join() method. Python3 1== # importing the module import pandas as pd # creating 2 DataFrames location = pd.DataFrame({'area' : ['new-york', 'columbo', 'mumbai']}) food = pd.DataFrame({'food': ['pizza', 'crabs', 'vada-paw']}) # concatenating the DataFrames dt = location.join(food) # displaying the DataFrame print(dt) Output : For the three methods to concatenate two columns in a DataFrame, we can add different parameters to change the axis, sort, levels etc. Comment More infoAdvertise with us Next Article Concatenate two columns of Pandas dataframe J jainanjali733985 Follow Improve Article Tags : Python Python-pandas Python pandas-dataFrame Practice Tags : python Similar Reads How to Concatenate Column Values in Pandas DataFrame? 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 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 Count number of columns of a Pandas DataFrame Let's discuss how to count the number of columns of a Pandas DataFrame. Lets first make a dataframe. Example: Python3 # Import Required Libraries import pandas as pd import numpy as np # Create a dictionary for the dataframe dict = {'Name': ['Sukritin', 'Sumit Tyagi', 'Akriti Goel', 'Sanskriti', 'Ab 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 Concatenate two PySpark dataframes In this article, we are going to see how to concatenate two pyspark dataframe using Python. Creating Dataframe for demonstration: Python3 # Importing necessary libraries from pyspark.sql import SparkSession # Create a spark session spark = SparkSession.builder.appName('pyspark - example join').getOr 3 min read Like