so the problem I am stuck with is, I am unsure of how to call a dictionary inside a function.
>>> play = pd.DataFrame(play)
>>> play
No Yes
0 Wednesday Monday
1 Thursday Tuesday
2 Saturday Friday
>>> days = 'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'
>>> newdict = {}
>>> numbincrease = 0
>>> for i in days:
newdict[i] = numbincrease
numbincrease = numbincrease + 1
>>> print(newdict)
{'Monday': 0, 'Tuesday': 1, 'Wednesday': 2, 'Thursday': 3, 'Friday': 4, 'Saturday': 5}
So I want to convert the days to numbers, the output should be able to iter over all the columns and all the rows and read the dictionary and replace with the appropriate value from the dictionary used in the program. The output should look like,
>>> play
No Yes
0 2 0
1 3 1
2 5 4
I have searched for many ways to do this, but it doesn't seem to work. I have no idea of how to call a function to iterate over each column and apply call dictionary to that value and continue with next row or column. Please help, Thank you