Question: Please make sure that the code works and specify the purpose for which you wrote the codes ( PYTHON ) import numpy import pandas class
Please make sure that the code works and specify the purpose for which you wrote the codes PYTHON
import numpy
import pandas
class InputErrorException:
pass
class ForgetfulCounter:
The purpose of the Forgetful Counter class is to enable a server computer in a data transfer and editing station
to track how many requests have been made by other computers within a specified time period.
def initself memorytimems:
Each computer can make a certain number of requests within a specified time period.
Therefore, a ForgetfulCounter object created for each requesting computer
can be initialized with a different memorytimems value.
pass
def pingself querytimems:
Args:
querytimems: Specifies the time of the most recent query from the requesting computer. Must be positive.
It should be greater than the previous value.
Returns:
result: Returns the number of queries from the requesting computer within the "memorytimems specified time period,
including the last query made. Should be of type int
Example:
computer ForgetfulCounter
currentcount computerping Returns because ping was received within the : time range.
currentcount computerping Returns because pings were received within the : time range.
currentcount computerping Returns because pings were received within the : time range.
currentcount computerping Returns because pings were received within the : time range.
currentcount computerping Returns because pings were received within the : time range.
return NotImplementedError
def fillspacesdata: numpy.array, editingmode: int numpy.array:
This function will take a numpy.array of size m where m as input.
It is known that the valid numbers within this array are between and
It will fill all values that do not comply with the specified range;
with the previous valid value if editingmode is
with the average value of the previous and next valid values if editingmode is
with the average value of the remaining values if editingmode is
If all data values are outside the desired range, False will be returned.
Args:
data: numpy.array
Returns:
result: numpy.array or bool False
Example:
data: numpy.array
editingmode:
result: numpy.array
editingmode:
result: numpy.array
editingmode:
result: numpy.array
return NotImplementedError
def removeduplicatesdf: pandas.DataFrame pandas.DataFrame:
This function removes rows of duplicate timestamps in a DataFrame with timestamps in its first column
column name is not known and keeps only the row of the most recentnewest timestamp in the DataFrame.
The input DataFrame remains unchanged when this function is executed.
Args:
df: DataFrame pandasDataFrame
Returns:
result: DataFrame pandasDataFrame
Example:
Shown in the visual.
return NotImplementedError
def daysuntilendofyearinputdate: str int:
This function returns the number of days left until the end of the year when a date in the format of YYYYMMDD is received.
The current day is not counted.
Args:
inputdate: str
Returns:
result: int
Example:
inputdate
result
return NotImplementedError
def mymaxpoolingmatrix: numpy.array numpy.array:
When a square matrix of size N N with N being an even number is received as input,
this function creates a new square matrix of size N N using the maximum number
in each nonoverlapping area.
Args:
matrix numpyarray: Input array of size NN N is a multiple of
Returns:
result: numpy.array
Example:
Shown in the visual.
return NotImplementedError
def findproblematicboroughsdf: pandas.DataFrame list:
This function returns the names of the top boroughs with the highest number of illegal parking complaints
Illegal Parking Complaints and their complaint counts as tuples from the DataFrame
servicerequests.csv read with the fileread function.
Args:
df: Dataframe pandasDataFram
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
