I have a data of over 600 employees' attendance over a period of month.
I have to get the count of absents of each employee and write it to another excel sheet.
So I initiated a for loop as shown below:
Im storing the value counts in a list and that includes the count of all variables in the row named status in picture 1.
How do I store only the count value of A(absent) in a list so I could use it accordingly.
Note: I know that status.loc['A'] gives the count of absent but when I try to use it in the loop it says key error.
If I can't get the value of A from status.loc , is there a way to extract it from the list i stored it in named absent?
Please help me out! Thanks in advance!!
CodePudding user response:
You should just do error handeling:
try:
absent.append(status.loc['A'])
except:
<rest of code here>