0
0
Data Analysis Pythondata~10 mins

Survey data analysis 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 survey data from a CSV file into a DataFrame.

Data Analysis Python
import pandas as pd

data = pd.[1]('survey_data.csv')
Drag options to blanks, or click blank then click option'
Aread_json
Bread_csv
Cread_excel
Dread_table
Attempts:
3 left
💡 Hint
Common Mistakes
Using read_excel for a CSV file causes errors.
Trying to use read_json when the file is not JSON format.
2fill in blank
medium

Complete the code to calculate the average age from the survey data.

Data Analysis Python
average_age = data['age'].[1]()
Drag options to blanks, or click blank then click option'
Acount
Bsum
Cmean
Dmedian
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum() returns total, not average.
Using count() returns number of entries, not average.
3fill in blank
hard

Fix the error in the code to filter survey responses where satisfaction is greater than 3.

Data Analysis Python
high_satisfaction = data[data['satisfaction'] [1] 3]
Drag options to blanks, or click blank then click option'
A>
B==
C=
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' causes syntax error in filtering.
Using '==' filters only values equal to 3, not greater.
4fill in blank
hard

Fill both blanks to create a dictionary of counts for each response in the 'feedback' column where length is more than 10 characters.

Data Analysis Python
feedback_counts = {response: data['feedback'].value_counts()[response] for response in data['feedback'] if len(response) [1] 10 and response [2] ''}
Drag options to blanks, or click blank then click option'
A>
B<
C!=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' filters short feedback, not long.
Using '==' for empty string includes empty feedback.
5fill in blank
hard

Fill all three blanks to create a dictionary with keys as uppercase feedback and values as counts for feedback longer than 5 characters.

Data Analysis Python
result = {response[1]: data['feedback'].value_counts()[response] for response in data['feedback'] if len(response) [2] 5 and response [3] ''}
Drag options to blanks, or click blank then click option'
A.upper()
B>
C!=
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using .lower() instead of .upper() changes case incorrectly.
Using '<' filters short feedback, not long.
Using '==' includes empty strings.