Ahmad
Ahmad

Reputation: 413

How to remove a value from

I have a dataframe asp_correct. I want to count the unique items from the column Predicted in the dataframe. I am using the following code:

correct_tokens = asp_correct['Predicted'].value_counts()
correct_tokens[:20].plot.bar()

The output is: enter image description here

However, I want to visualize all items except O.. How I could do that? Thanks in advance!

Upvotes: 0

Views: 53

Answers (3)

sebas0205
sebas0205

Reputation: 113

You can create a dataframe removing O value :

     
   correct_tokens = asp_correct[asp_correct['Predicted'] != 'O']['Predicted'].value_counts()
 

Upvotes: 0

Targo
Targo

Reputation: 67

correct_tokens is a Series.

Could you try correct_tokens = correct_tokens.drop(labels=['O'])?

Upvotes: 2

BENY
BENY

Reputation: 323226

Try with drop

correct_tokens = correct_tokens.drop('O')

Upvotes: 0

Related Questions