Code >
file.vb
import pandas as pd
data = {'Name': ['Snake', 'Prince', 'Gangsta', 'Wolf'],
'City':['Pune','Nasik','Kolhapur','Bangalore'],
'Qualification': ['Msc', 'MA', 'Msc', 'Msc']}
df = pd.DataFrame(data)
print("Old:\n",df)
df.insert(1, "Age", [21, 23, 24, 21], True)
Output > (OLD)
Output
**Old:**
Name City Qualification
Snake Pune Msc
Prince Nasik MA
Gangsta Kolhapur Msc
Wolf Bangalore Msc
New > (OLD)
Name | Age | City | Qualification |
---|---|---|---|
Snake | 21 | Pune | Msc |
Prince | 23 | Nasik | MA |
Gangsta | 24 | Kolhapur | Msc |
Wolf | 21 | Bangalore | Msc |