Advertisement
elena1234

how to insert column in dataframe in Python

Dec 31st, 2022 (edited)
1,472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | Source Code | 0 0
  1. import pandas as pd
  2.  
  3. relatives = titanic.sibsp + titanic.parch # pandas series
  4. titanic.insert(loc = 6, column = 'relatives', value = relatives)
  5.  
  6. ##################################################################################
  7. players.insert(loc = 4, column = 'Height in cm', value = players.Height * 100)
  8.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement