Question: Question 4 : fine _ per _ plates ( ) Starting in 2 0 0 4 Michigan moved to issuing plates with the format of
Question : fineperplates
Starting in Michigan moved to issuing plates with the format of ABC That got me thinking, how many vanity plate holders there are in our
dataset? Count for me the number of Michigan vehicles with plates in the following formats that have received a ticket:
ABC
ABC
ABC
Vanity Plates ie anything other than the aforementioned formats, including missing or NaN values
Complete the function fineperplates returning a dictionary. The dictinary should be formatted as follows:
ict ABC: ehicles,
ABC: ehicles,
ABC: ehicles
vanity: ehicles code:import pandas as pd
import numpy as np
import re
def fineperplates:
platesdict ABC: "ABC: ABC": "vanity":
data pdDataFramePlate: ABCABC", XYZ "VANITY"
abcpattern recompilerAZd$
abcpattern recompilerAZd$
aabcpattern recompilerdAZ$
for plate in dataPlate:
if abcpattern.matchplate:
platesdictABC
elif abcpattern.matchplate:
platesdictABC
elif aabcpattern.matchplate:
platesdictABC"
else:
platesdictvanity
return platesdict
# Test the function
printfineperplates the problem is : TypeError Traceback most recent call last
Cell In line
assert lenfineperplates "Return a dictionary with four items."
TypeError: fineperplates missing required positional argument: 'datapath'
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
