Hi! I need help with a PYTHON code. I’m creating a code on gender…
Question Answered step-by-step Hi! I need help with a PYTHON code. I’m creating a code on gender… Hi! I need help with a PYTHON code. I’m creating a code on gender wage gap and I just just help creating some graphs. I have attached the data sources and the code I already have below.I need help with these questionsGraph the wage comparisons for male and females in bar graphs for the different countries in the data. List countries best to worst and include each bar being able to list money in dollars and the country’s currency when clicked. Graph the female vs male salaries in all the careers together for a wide look.Take the careers separately and graph each of the careers to see which results come out for each career and which gender is more successful in terms of wage.DATA LINKS1) https://data.census.gov/cedsci/table?q=b24122&tid=ACSDT1Y2019.B241222) https://www.kaggle.com/datasets/ayessa/salary-prediction-classification3) https://www.bls.gov/cps/earnings.htm4) https://www.kaggle.com/datasets/mpwolke/cusersmarildownloadsgapcsv CODEimport pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport seaborn as snsdata = pd.read_csv(‘gap.csv’,sep=’;’)datar_data = pd.read_excel(‘2019_Data_Professional_Salary_Survey_Responses.xlsx’,header = 2)r_data.head()#Convert all of the salary rows into stringdef str_salary(salary): sep = ‘.’ if type(salary) == int: salary = str(salary) elif type(salary) == str: # Replace characteres and take the cents out of our data salary = salary.replace(” “,””).replace(“$”,””).replace(“,”,””).split(sep)[0] elif type(salary) == float: salary = str(salary) return salary# Replace spaces(” “) in columns name with underscore (“_”)r_data.columns = r_data.columns.str.replace(” “,”_”)# Apply str_salary functionr_data[‘SalaryUSD’] = r_data.SalaryUSD.apply(str_salary)r_data[‘SalaryUSD’].head()data.describe()data.info()data.location.value_counts()for column in data.columns: if column!=’location’: print(column, data[column].unique())data.groupby(‘subject’).size().plot(kind=’pie’, autopct=’%.2f’,label=’Self employed vs employee’)sns.histplot(data.time)def value_first(x): return int(x.split(‘.’)[0])data[‘values_first’] = data[‘value’].apply(value_first)data[‘values_first’]data[(data.time==2005)&(data.subject==’EMPLOYEE’)].sort_values(‘values_first’) Computer Science Engineering & Technology Python Programming SDF SD WEFA E 123 Share QuestionEmailCopy link Comments (0)


