1

In my pandas Dataframe i want to access the status column and count the number of times the value Fail appears. I am trying to implement a groupby method in order to see the number of fails but i am getting a weird output in the picture:

total = df.groupby("status").sum()

h

1 Answer 1

2
In [38]: df = pd.DataFrame(["Fail","OK"] * 9, columns=["status"])

In [39]: df["status"].value_counts()
Out[39]:
OK      9
Fail    9
Name: status, dtype: int64

Use value_counts() to get the count of occurrence

Sign up to request clarification or add additional context in comments.

1 Comment

The above was just an example. The main command to use is value_counts() on your column

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.