Count occurences in pandas column database and bar plot with matplotlib
up vote
0
down vote
favorite
So I have a pandas database with 4 columns.
Date A B C.
The dates contain all daily dates from year 2018, 2019 and 2020.
These columns A B C contains numbers from 1 to 7. No decimals.
I want to count each of this number occurences and stack them into a bar plot.
Count all 1's, 2's, 3's ect.
Anyone got a good solution for this?
pandas matplotlib
add a comment |
up vote
0
down vote
favorite
So I have a pandas database with 4 columns.
Date A B C.
The dates contain all daily dates from year 2018, 2019 and 2020.
These columns A B C contains numbers from 1 to 7. No decimals.
I want to count each of this number occurences and stack them into a bar plot.
Count all 1's, 2's, 3's ect.
Anyone got a good solution for this?
pandas matplotlib
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So I have a pandas database with 4 columns.
Date A B C.
The dates contain all daily dates from year 2018, 2019 and 2020.
These columns A B C contains numbers from 1 to 7. No decimals.
I want to count each of this number occurences and stack them into a bar plot.
Count all 1's, 2's, 3's ect.
Anyone got a good solution for this?
pandas matplotlib
So I have a pandas database with 4 columns.
Date A B C.
The dates contain all daily dates from year 2018, 2019 and 2020.
These columns A B C contains numbers from 1 to 7. No decimals.
I want to count each of this number occurences and stack them into a bar plot.
Count all 1's, 2's, 3's ect.
Anyone got a good solution for this?
pandas matplotlib
pandas matplotlib
asked Nov 11 at 2:08
oppsig
142
142
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Using melt
with value_counts
df.melt('Date').value.value_counts().plot(kind='bar')
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Using melt
with value_counts
df.melt('Date').value.value_counts().plot(kind='bar')
add a comment |
up vote
0
down vote
Using melt
with value_counts
df.melt('Date').value.value_counts().plot(kind='bar')
add a comment |
up vote
0
down vote
up vote
0
down vote
Using melt
with value_counts
df.melt('Date').value.value_counts().plot(kind='bar')
Using melt
with value_counts
df.melt('Date').value.value_counts().plot(kind='bar')
answered Nov 11 at 2:17
W-B
93.8k72756
93.8k72756
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245243%2fcount-occurences-in-pandas-column-database-and-bar-plot-with-matplotlib%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown