Search code examples
pythonpandaslistdataframeseries

How to extract a value if there is no column name?


Table Image I have an excel sheet as shown above with data of employees' attendance per month. There is a row with heading status which shows number of absents of an employee. Normally I would go with:

status = data.iloc[i].value_counts()

which returns the count of all the variables in that row including the heading status.

For example, the output is:

Sample Output

I only need the count of A(absents). How do I achieve that?

Thanks in advance!!!


Solution

  • You can also access a specific value in "status" variable by:

    status.loc["A"]
    

    returns only the number of absents.