text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_csv('/kaggle/input/analytics-industry-salaries-2022-india/Salary Dataset.csv')

df.columns

xdf = df.rename(columns={'Company Name': 'company_name', 'Job Title': 'job_title', 'Salaries Reported': 'sal_reported', 'Location': 'location', 'Salary': 'salary'})
xdf.columns

xdf['currency'] = xdf['salary'].str.slice(start=0, stop=1)
xdf['duration'] = xdf['salary'].str.split('/', expand=True)[1]
xdf['sal'] = xdf['salary'].str.split('/', expand=True)[0].str.slice(start=1).str.replace(',', '')

xdf['sal'] = xdf['sal'].astype('float64')

xdf.isna().sum()

conversionVal = {'₹': 0.013, '$': 1, '£': 1.36, 'AFN': 0.011}
conversionVal

xdf['salary_usd'] = 0
for key, value in conversionVal.items():
    for x, xRow in xdf.iterrows():
        if key in xRow['currency']:
            salVal = xRow['sal']
            salVal = round(int(salVal) * value, 2)
            xdf.at[x, 'salary_usd'] = salVal
xdf

xdf[xdf.index == 3876]