Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Visualize ROI | Becoming an Analyst
Introduction to Python for Data Analysis

book
Visualize ROI

In the previous chapter, we calculated ROI daily, which will help us recognize the unprofitable day. Indeed, if we know that Monday is unprofitable, we should spend less money to attract users, for example!

It is tough to conclude without graphs, so visualize ROI!

Завдання

Swipe to start coding

  1. Create barplot with the arguments:
  • df as the data parameter.
  • 'day' column for x-axis.
  • 'ROI' column for y-axis.
  1. Output barplot

Рішення

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# You've already calculated ROI by week days
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/783d7288-e86b-4b89-9966-a2fe97995277/section_3_dataset_upd.csv')
df = df[['day', 'cost', 'money_spent']].groupby('day').sum().reset_index()
df['ROI'] = ((df['money_spent'] - df['cost'])/ df['cost'])*100

# Create barplot
sns.barplot(data = df, x = 'day', y = 'ROI')
# Output barplot
plt.show()

Congratulations! We figured out that Monday and Thursday are the most unprofitable days. Further, it is fantastic to find out whether these two days are similar or if we are making the same mistake on Monday and Thursday. But to do it, you should continue learning courses that will help you to become a Data Analyst.

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 11
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# You've already calculated ROI by week days
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/783d7288-e86b-4b89-9966-a2fe97995277/section_3_dataset_upd.csv')
df = df[['day', 'cost', 'money_spent']].groupby('day').sum().reset_index()
df['ROI'] = ((df['money_spent'] - df['cost'])/ df['cost'])*100

# Create barplot
___.___(data = ___, x = ___, y = ___)
# Output barplot
___

Запитати АІ

expand
ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt