Putting column name to dataframe, can't work. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Putting column name to dataframe, can't work. (/thread-35028.html) |
Putting column name to dataframe, can't work. - jonah88888 - Sep-24-2021 I tried to put a column name for normal dataframe by putting df.columns = ['ColumnName'] It works. But, after I pd.concat(df,df1), I can't put a column name to it. Any idea I also tried df.rename = ['ColumnName'] RE: Putting column name to dataframe, can't work. - deanhystad - Sep-28-2021 Do you want to change the name of an existing column (rename) or add a column? Adding a column is easy: df['New Column Name'] = valuesWhere "New Column Name" is the name you want to use to ID the column and values is the list/array/whatever that you want to add. |