Answer Seeker
Lesson 18 of 19 in Coddy's Pandas Analytics course.
Challenge
MediumThe 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_wordsand calculate how many words each answer has. - Create a column named
num_exclamationand calculate how many exclamation marks each answer has. - Create a column named
num_questionand calculate how many question marks each answer has. - Create a column named
num_dotand calculate how many dots each answer has. - Create a column named
num_symbolsthat sumsnum_exclamation,num_questions, andnum_dots. - Create a column named
upper_charsand 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
4Data Analysis with Pandas
Descriptive StatisticsGrouping and Aggregating DataDifferent AggregationsMerge & Concat2Working with the DataFrame
Understanding DataFramesAccessing DataData Cleaning - Missing dataData Cleaning - More tools3Data Manipulation with Pandas
Return Requested ResultFilter DataAdd & DeleteModify DataModify StringsCustom Modifications