Your code is misleading as you named your data set "series" but in the third line of code "series" is…