Chapter 3
Regular Expressions
Section 4
Regular Expressions in CSV files
We've covered most of the regular expression syntax, but we haven't used them in a real-world circumstance yet. We're going to open our baseball dataset and find the average number of away team scores in the month of March. - We begin by extracting the date column and the away team runs column. We use a regular expression on the date column to create a Boolean list of March/Not-March values - Next, we zip the Boolean list with the away team runs, and then filter everything that has a true value - Finally, we drop the true values and pass the filtered list to our mean function