0
0
Data Analysis Pythondata~10 mins

Web analytics data pattern in Data Analysis Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load the web analytics data from a CSV file.

Data Analysis Python
import pandas as pd
data = pd.read_csv([1])
Drag options to blanks, or click blank then click option'
A'web_data.csv'
Bweb_data.csv
C'data/web_analytics.csv'
Dweb_analytics.csv
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the file name in quotes.
Using a variable name without defining it.
2fill in blank
medium

Complete the code to display the first 5 rows of the data.

Data Analysis Python
print(data.[1]())
Drag options to blanks, or click blank then click option'
Asample
Btail
Chead
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Using tail() which shows the last rows.
Using info() which shows summary info, not rows.
3fill in blank
hard

Fix the error in the code to calculate the average session duration.

Data Analysis Python
average_duration = data['session_duration'].[1]()
Drag options to blanks, or click blank then click option'
Asum
Bmean
Ccount
Dmax
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum() which adds all values.
Using count() which counts non-null entries.
4fill in blank
hard

Fill both blanks to create a dictionary of page views for pages with more than 100 views.

Data Analysis Python
page_views = {page: data[data['page'] == page]['views'].[1]() for page in data['page'].unique() if data[data['page'] == page]['views'].[1]() [2] 100}
Drag options to blanks, or click blank then click option'
Asum
Bmean
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean() instead of sum().
Using < instead of > in the condition.
5fill in blank
hard

Fill all three blanks to create a filtered DataFrame with sessions longer than 5 minutes and sort by duration descending.

Data Analysis Python
filtered = data[data['session_duration'] [1] [2]].sort_values(by=[3], ascending=False)
Drag options to blanks, or click blank then click option'
A>
B300
C'session_duration'
D'duration'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column name for sorting.
Filtering with less than or equal instead of greater than.