You can use the assign function:

df = df.assign(industry='yyy')
Answer from Mina HE on Stack Overflow
🌐
Medium
medium.com › @whyamit101 › pandas-set-column-names-a-comprehensive-guide-130c84f8761a
Pandas Set Column Names: A Comprehensive Guide | by why amit | Medium
April 12, 2025 - Yes, while pandas allows repeated column names, it’s best practice to keep them unique to avoid confusion during data manipulation and analysis. How can I check the current column names in a DataFrame? You can check the column names of a DataFrame easily using df.columns, which returns an index object containing the list of column names. Setting and changing column names is an essential skill in data manipulation with pandas.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-set-cell-value-in-pandas-dataframe
How to Set Cell Value in Pandas DataFrame? - GeeksforGeeks
July 23, 2025 - Here we are using the Pandas loc() method to set the column value based on row index and column name
🌐
TutorialKart
tutorialkart.com › python › pandas › pandas-dataframe-set-column-names
How to set Column Names for DataFrame in Pandas?
July 9, 2021 - To set column names of DataFrame in Pandas, use pandas.DataFrame.columns attribute. Assign required column names as a list to this attribute.
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.set_index.html
pandas.DataFrame.set_index — pandas 3.0.5 documentation
Whether to append columns to existing index. Setting to True will add the new columns to existing index.
🌐
Python Examples
pythonexamples.org › pandas-set-column-as-index
Set Column as Index in Pandas DataFrame - Examples
In this example, we will pass multiple column names as an array to set_index() method to setup MultiIndex for the Pandas DataFrame.
Find elsewhere
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.html
pandas.DataFrame — pandas 3.0.5 documentation - PyData |
>>> df2 = pd.DataFrame( ... np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=["a", "b", "c"] ...
🌐
GitHub
github.com › pandas-dev › pandas › issues › 5909
set_columns() equivalent of set_index() ? · Issue #5909 · pandas-dev/pandas
January 11, 2014 - One can directly manipulate the .columns attribute of the DF, but it's often convenient to be able to alter columns in-line after some other operation--e.g., data = pd.concat([df_a, df_b], axis=1).set_columns(['a', 'b', 'c'])
Author   pandas-dev
🌐
Statology
statology.org › home › how to set value for a specific cell in pandas dataframe
How to Set Value for a Specific Cell in Pandas DataFrame
August 20, 2021 - You can use the following basic syntax to set the value for a specific cell in a pandas DataFrame: #set value at row index 0 and column 'col_name' to be 99 df.at[0, 'col_name'] = 99
🌐
GeeksforGeeks
geeksforgeeks.org › add-column-names-to-dataframe-in-pandas
Add column names to dataframe in Pandas - GeeksforGeeks
November 28, 2024 - While analyzing the real datasets which are often very huge in size, we might need to get the pandas column names in order to perform certain operations. The simplest way to get column names in Pandas is by using the .columns attribute of a DataFrame.
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas set index to column in dataframe
Pandas Set Index to Column in DataFrame - Spark By {Examples}
November 14, 2024 - In order to set the index to a column in pandas DataFrame use reset_index() method. By using this you can also set single, multiple indexes to a column.
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Set a column as the DataFrame index with set_index() | note.nkmk.me
January 26, 2024 - Setting append=True adds the specified column to the index as a new level.
🌐
GitHub
github.com › pandas-dev › pandas › issues › 45140
ENH: add ExcelWriter set_column functionality for ODF Open Document Format · Issue #45140 · pandas-dev/pandas
December 31, 2021 - Hello, Please, add possibility to setting column width: set_column support in ExcelWriter class for ODF open standard documents. Currently pandas doesn't support it. Pandas supports (and working fine) set_column for XLSX Excel files. Sim...
Author   pandas-dev
🌐
Stack Overflow
stackoverflow.com › questions › 74362719 › using-set-with-pandas
python - using set() with pandas - Stack Overflow
Yes, I used df1.iloc[:, 0] to isolate the column but when I tried to print the following: print(set(df1.iloc[:,0]) The function set() consider the index not the first column!