0

In my pandas dataframe I have a column named "crashhour" which have two values that is offtime and picktime. How to take only the values of offtime. Below is the code of Column value count.

a=df.crashhour.value_counts()

And this is the output-

offtime     19639
picktime    14068
Name: crashhour, dtype: int64

I want to store only the offtime values in a variable like 19639 should be the output. How to do that?

1 Answer 1

1

Use Series.loc:

var = a.loc['offtime']
Sign up to request clarification or add additional context in comments.

Comments

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.