Reputation: 227
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()
Upvotes: 1
Views: 32
Reputation: 17368
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
Upvotes: 2