How Much Do We Earn
You may recognize the column 'money_spent' that corresponds to the amount of money the user spent and gained. In this chapter, we will find if there is any dependence between the day of the week and the amount of money we have!
But firstly, recall some functions:
Group Data:
12df = df[['columns which we group']] .groupby(['columns on which we group'])
Visualization:
1234sns.barplot(df = DataFrame, x = 'column for x-axis', y = 'column for y-axis') plt.show()
Swipe to start coding
- Group data:
- Extract only columns
'day', 'money_spent'from thedfDataFrame. - Group by the column
'day'. - Apply
.mean()function to groupeddf. - Apply
.reset_index()function.
- Create a barplot:
- Use
dfas the first argument. - Use column
'day'for x-axis. - Use the column
'money_spent'for the y-axis.
- Output barplot.
Lösung
Danke für Ihr Feedback!
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Zusammenfassen Sie dieses Kapitel
Code in file erklären
Erklären, warum file die Aufgabe nicht löst
Awesome!
Completion rate improved to 2.08
How Much Do We Earn
Swipe um das Menü anzuzeigen
You may recognize the column 'money_spent' that corresponds to the amount of money the user spent and gained. In this chapter, we will find if there is any dependence between the day of the week and the amount of money we have!
But firstly, recall some functions:
Group Data:
12df = df[['columns which we group']] .groupby(['columns on which we group'])
Visualization:
1234sns.barplot(df = DataFrame, x = 'column for x-axis', y = 'column for y-axis') plt.show()
Swipe to start coding
- Group data:
- Extract only columns
'day', 'money_spent'from thedfDataFrame. - Group by the column
'day'. - Apply
.mean()function to groupeddf. - Apply
.reset_index()function.
- Create a barplot:
- Use
dfas the first argument. - Use column
'day'for x-axis. - Use the column
'money_spent'for the y-axis.
- Output barplot.
Lösung
Danke für Ihr Feedback!
single