Course Content
Introduction to Python for Data Analysis
Introduction to Python for Data Analysis
2. Introduction to Python 2/2
3. Explore Dataset
Data StudyOperations with the FileHow to Explore the DataSorting DataMax, min, mean, medianChallengeGroup DataDive Deeper into Grouping DataGroup Data 2.0Introduction to NumPyPivot TablesRecall Loops.loc FunctionDeal with Several ConditionsChallengeVisualization: First StepsDive Deeper into Visualization
ROI 2/2
As you can recognize from the previous chapter, we have some problems with ROI in general; we received -19.644756245106056
%. Unfortunately, we suffer losses. In this case, we must dive deeper and find the reason.
The next step of our research is to check if we have unprofitable days.
Task
Swipe to start coding
- Group data:
- Extract only columns
'day', 'cost', 'money_spent'
from thedf
DataFrame. - Group by the column
'day'
. - Apply
sum()
function to grouped data. - Apply
reset_index()
function.
- Create column
'ROI'
:
- Subtract
df['cost']
fromdf['money_spent']
- Divide the result by
df['cost']
.
Solution
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 10
ROI 2/2
As you can recognize from the previous chapter, we have some problems with ROI in general; we received -19.644756245106056
%. Unfortunately, we suffer losses. In this case, we must dive deeper and find the reason.
The next step of our research is to check if we have unprofitable days.
Task
Swipe to start coding
- Group data:
- Extract only columns
'day', 'cost', 'money_spent'
from thedf
DataFrame. - Group by the column
'day'
. - Apply
sum()
function to grouped data. - Apply
reset_index()
function.
- Create column
'ROI'
:
- Subtract
df['cost']
fromdf['money_spent']
- Divide the result by
df['cost']
.
Solution
Everything was clear?
Thanks for your feedback!
Section 4. Chapter 10