# -*- coding: utf-8 -*-
"""update_csv.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1F66W9vtZHUiiNtTm-f2_x0mwJPxPwe_a
"""

import pandas as pd
import numpy as np

df=pd.read_csv("/content/final.csv")

df['Age']=df['Age'].astype(int)

df.head()

df["shopping_expense"]=""

df["travel_expense"]=""

df["medical_expense"]=""

df["entertainment_expense"]=""

df.head()

df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']

df.tail()

df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Germany'),'EstimatedSalary'] 
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='France'),'EstimatedSalary'] 
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Germany'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'EstimatedSalary'] 

df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Germany'),'EstimatedSalary'] 
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='France'),'EstimatedSalary'] 
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Germany'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'EstimatedSalary']
786771f2a3420101228b1100db76e804d8576fb4
<mask token>

<mask token>
df.head()
<mask token>
df.head()
<mask token>
df.tail()
<mask token>

<mask token>
df = pd.read_csv('/content/final.csv')
df['Age'] = df['Age'].astype(int)
df.head()
df['shopping_expense'] = ''
df['travel_expense'] = ''
df['medical_expense'] = ''
df['entertainment_expense'] = ''
df.head()
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.tail()
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'married') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'France'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'single') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'France'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Spain'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'divorced') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'France'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Germany'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'France'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Spain'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']

<mask token>
import pandas as pd
import numpy as np
df = pd.read_csv('/content/final.csv')
df['Age'] = df['Age'].astype(int)
df.head()
df['shopping_expense'] = ''
df['travel_expense'] = ''
df['medical_expense'] = ''
df['entertainment_expense'] = ''
df.head()
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.tail()
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'married') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'France'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'single') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'France'),
    'EstimatedSalary']
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Spain'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] >= 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] >= 35) & (df
    ['marital'] == 'divorced') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'France'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'married') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'married') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'France'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Spain'), 'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'single') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'single') & (df['Geography'] == 'Germany'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'France'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'France'),
    'EstimatedSalary']
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Spain'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Spain'), 'EstimatedSalary'
    ]
df.loc[(df['Age'] < 35) & (df['marital'] == 'divorced') & (df['Geography'] ==
    'Germany'), 'shopping_expense'] = 0.05 * df.loc[(df['Age'] < 35) & (df[
    'marital'] == 'divorced') & (df['Geography'] == 'Germany'),
    'EstimatedSalary']

# -*- coding: utf-8 -*-
"""update_csv.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1F66W9vtZHUiiNtTm-f2_x0mwJPxPwe_a
"""

import pandas as pd
import numpy as np

df=pd.read_csv("/content/final.csv")

df['Age']=df['Age'].astype(int)

df.head()

df["shopping_expense"]=""

df["travel_expense"]=""

df["medical_expense"]=""

df["entertainment_expense"]=""

df.head()

df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']

df.tail()

df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='married')&(df['Geography']=='Germany'),'EstimatedSalary'] 
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='France'),'EstimatedSalary'] 
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='single')&(df['Geography']=='Germany'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']>=35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'EstimatedSalary'] 

df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='married')&(df['Geography']=='Germany'),'EstimatedSalary'] 
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='France'),'EstimatedSalary'] 
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='single')&(df['Geography']=='Germany'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='France'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='France'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Spain'),'EstimatedSalary']
df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'shopping_expense']=0.05*df.loc[(df['Age']<35)&(df['marital']=='divorced')&(df['Geography']=='Germany'),'EstimatedSalary']