Menu
Coddy logo textTech

Answer Seeker

Lesson 18 of 19 in Coddy's Pandas Analytics course.

challenge icon

Challenge

Medium

The CSV file  answers.csv contains random answers. In this challenge, we will do a deep analysis.

Here is the first 5 lines of the file:

answer_id,value
1,"She learned that water bottles are no longer just to hold liquid, but they're also status symbols."
2,"When she didn’t like a guy who was trying to pick her up, she started using sign language."
3,"Eating eggs on Thursday for choir practice was recommended."
4,"He dreamed of leaving his law firm to open a portable dog wash."
  • Create a column named num_words and calculate how many words each answer has.
  • Create a column named num_exclamation and calculate how many exclamation marks each answer has.
  • Create a column named num_question and calculate how many question marks each answer has.
  • Create a column named num_dot and calculate how many dots each answer has.
  • Create a column named num_symbols that sums num_exclamation, num_questions, and num_dots.
  • Create a column named upper_chars and calculate how many upper-case letters are in an answer.

 question mark and dot are special characters. Add "\"  and <strong>r</strong> (raw) before the string when working with them: r"\?", r"\."

Save the result to df

Try it yourself

# pandas as pd is already imported
df = pd.read_csv("./answers.csv")
# Write your code below

All lessons in Pandas Analytics