I have this python dictionary myDict:
{'Age': {0: '39'}, 'DailyRate': {0: '903'}, 'DistanceFromHome': {0: '2'}, 'EnvironmentSatisfaction': {0: '1'}, 'HourlyRate': {0: '41'}, 'JobInvolvement': {0: '4'}, 'JobLevel': {0: '3'}, 'JobSatisfaction': {0: '3'}, 'MonthlyIncome': {0: '7880'}, 'MonthlyRate': {0: '2560'}, 'NumCompaniesWorked': {0: '0'}, 'PercentSalaryHike': {0: '18'}, 'RelationshipSatisfaction': {0: '4'}, 'StandardHours': {0: '80'}, 'TotalWorkingYears': {0: '9'}, 'TrainingTimesLastYear': {0: '3'}, 'YearsAtCompany': {0: '8'}, 'YearsInCurrentRole': {0: '7'}, 'YearsSinceLastPromotion': {0: '0'}, 'YearsWithCurrManager': {0: '7'}, 'MaritalStatus_': {0: '2'}, 'JobRole_': {0: '7'}, 'Gender_': {0: '1'}, 'EducationField_': {0: '1'}, 'Department_': {0: '2'}, 'BusinessTravel_': {0: '2'}, 'OverTime_': {0: '1'}, 'Over18_': {0: '1'}}
As you can see, if i get a one from above sample as below,
{'Age': {0: '39'}}
There is an additional 0 in front of the value 39. And this zero presents in every key-value pair.
How can I get rid of this 0, so it looks like this:
{'Age': '39'}
I tried this method, but it removes the whole key instead of the 0:
map(myDict.pop, ['Age',''])
Can someone please help me?
{k: v[0] for k, v in myDict.items()}?k,vhere?