Columns are the different fields which contains their particular values when we create a DataFrame. We can perform certain operations on both rows & column values. Sometimes we need to add a column in our dataset and this creation depends upon some condition. Here, we are creating a new column in the DataFrame where all the values of the column are same i.e., constant.
To work with pandas, we need to import pandas package first, below is the syntax:
import pandas as pd
Let us understand with the help of an example:
Output:

need an explanation for this answer? contact us directly to get an explanation for this answer