Consider the following code:
import pandas as pd
def calc_mard(x: pd.Series, y: pd.Series) -> float:
x_at_y_timestamps: pd.Series = x[y.index]
error: pd.Series = y - x_at_y_timestamps
mard: float = 100.0 * (error.abs() / x).mean()
return mard
Running mypy from a mac terminal command line on a file containing this code takes around 40 seconds. Is this normal? The following error is found:
xxx.py:8: error: "Series[Any]" has no attribute "abs"
Found 1 error in 1 file (checked 1 source file)
I frequently get errors complaining about pandas series methods. What's going on here? The code certainly runs and produces expected results.