Post
Python
Posted on 27th April 2024|19 views
How can I add a new column in existing dataframe in pandas?
Posted on 27th April 2024
You can do it by declaring a new list as a column
Import pandas as pd
data = { ‘name’ : [‘Mayuri’, ‘Prachi’],
‘marks’ : [35, 80] }
df = pd.DataFrame(data)
id = [123, 188]
df[id] = id
df
STILL GOT QUERIES?