📜  python 如何将列添加到熊猫数据框 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:25.052000             🧑  作者: Mango

代码示例2
# Basic syntax:
pandas_dataframe['new_column_name'] = ['list', 'of', 'column', 'values']

# Note, the list of column values must have length equal to the number
#     of rows in the pandas dataframe you are adding it to.

# Add column in which all rows will be value:
pandas_dataframe['new_column_name'] = value
# Where value can be a string, an int, a float, and etc