2

I'm asking you my question here because after a long time on the internet, I didn't found anything. Here's the problem: I'm working on a data science project and I want to put some results on a plot.

I have a data frame which is group by 2 attributes (as you can see on the picture). Those two attributes are "id_campaign" and "dayofweek", and all I want is to put on the same graph in order to see if there is any trend. I have enough reputation points to put a picture now :D!

So here is my data frame, you will understand more easily i think

my df

2
  • 1
    (as you can see on the picture) ... what picture? I see no picture Commented Jul 1, 2015 at 12:53
  • hi Andersson, the picture is missing cause i don't have enough reputation to put it... I need at least a 10 pt reputation Commented Jul 1, 2015 at 13:12

1 Answer 1

2

It's hard to know exactly what you are trying to do w/o an example. Here are some plots I use when looked at "grouped by" data:

# imports
import matplotlib.pyplot as plt

Bar plot of average of column_c by column_a

df.groupby('column_a').column_c.mean().plot(kind='bar')
plt.ylabel('Average of Column C Per Column A')

Bar plot of total of column_c by column_a

df.groupby('column_a').column_c.sum().plot(kind='bar')
plt.ylabel('Total of Column C Per Column A')

Grouped histograms (shows the distribution for each group)

df.column_c.hist(by=df.column_a)
df.column_c.hist(by=df.column_a, sharex=True)  # common X axis
df.column_c.hist(by=df.column_a, sharex=True, sharey=True)  # common X and Y axis

Boxplot of column_c by column_a (shows five-number summary and outliers)

df.boxplot(column='column_c', by='column_a')

Scatterplot matrix of all numerical columns

pd.scatter_matrix(df)

Scatterplot matrix of specific numerical columns

pd.scatter_matrix(df[['column_1', 'column_2', 'column_3']])
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.