0

I have a dataset that looks like this:

Date of     Waivered 
Issuance    Regulation  month   day     year    107.29  107.31  
29/12/2017  107.29      12.0    29.0    2017.0  1.0     0.0
29/12/2017  107.29      12.0    29.0    2017.0  1.0     0.0
29/12/2017  107.29      12.0    29.0    2017.0  1.0     0.0
28/12/2017  107.29      12.0    28.0    2017.0  1.0     0.0
27/12/2017  107.29      12.0    27.0    2017.0  1.0     0.0

The last two columns ('107.29' and '107.31') only have 0 or 1 as value.

I want to create a count plot, but limit it only to the 1 values, so excluding the 0 values. When I create a regular count plot, this is what I have got:

enter image description here

In this plot you can barely see the 1 values, so I would like to have the graph with only those. How can I achieve that?

2
  • Can you please re-word your question a bit? Commented Feb 28, 2019 at 12:58
  • I mean that I want to create a count plot that includes only the 1 values, without the 0. In the previous plot, you can see that the 1 values can barely be seen. Commented Feb 28, 2019 at 13:32

2 Answers 2

1

Use the normalize parameter to normalize the counts over any variable (or combination of variables with a tuple). You can also use True to normalize over the grand total of counts.

import dexplot as dxp

dxp.count('107.31', data=df, split='month', normalize='107.31')
Sign up to request clarification or add additional context in comments.

Comments

0

This will give you only the 1's at the column '107.31':

df1 = df[df['107.31'] == 1]

Then you can group it by month, count the 1's for each month and plot:

df1.groupby('month').size().plot(kind='bar')

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.