Add a list of values to an existing DataFrame - Python Snippets - Snipit

PHOTO EMBED

Sun Jul 10 2022 05:52:05 GMT+0000 (Coordinated Universal Time)

Saved by @nilotpalc #python

# Create the new column as a list
new_col = ['Lee Kun-hee', 'Xu Zhijun', 'Tim Cook', 'Tony Chen', 'Shen Wei']

# Assign the list to the DataFrame as a column
df['Current Chairperson'] = new_col
df
content_copyCOPY

https://snipit.io/