1

I have the following dataframe: enter image description here

I'm trying to plot a bar chart, with x as 'config names', y as 'value', and one bar per month (one bin per month). I'm not sure how to do this, any ideas?

2 Answers 2

1

If you have your data in a pandas DataFrame (let's say df), it's rather easy:

import seaborn as sns

sns.barplot(x='config names', y='value', data='df')

I'm not sure what you mean by one bin per month. The bins here are your x axis.

If you mean you want to split different months into different bins then you should just add them to the hue parameter.

import seaborn as sns

sns.barplot(x='config names', y='value', data='df', hue='month')
Sign up to request clarification or add additional context in comments.

Comments

0

I may not understand what you ask but it looks like this So I suggest you do a pivot table with your dataframe. Let's say your dataframe variable name is df, can you try this :

import pandas as pd
import numpy as np

pt_df = pd.pivot_table(
  df, 
  values=['value'], 
  columns=['month'], 
  aggfunc=np.sum
).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.