Created
August 9, 2018 04:52
-
-
Save socratesk/438c9a98a5a2cea09a60388be26c3c14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
incExpDF = pd.DataFrame({'id' : [101, 102, 103, 104, 105], | |
'familyCnt' : [2, 4, 3, 3, 5], | |
'totalInc' : [68000, 72000, 34000, 44000, 52000], | |
'totalExp' : [48000, 66000, 33000, 41000, 50000]}) | |
incExpDF['incPerPerson'] = incExpDF['totalInc'] / incExpDF['familyCnt'] | |
incExpDF['expPerPerson'] = incExpDF['totalExp'] / incExpDF['familyCnt'] | |
incExpDF['savingsPerPerson'] = incExpDF['incPerPerson'] - incExpDF['expPerPerson'] | |
print(incExpDF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment