I'm very new to Python and I'm trying to walk through a fairly simple linear regression model. 

When I try and run this line of code I get the error 'Series' object has no attribute 'flatten' 

```
df4= pd.DataFrame({'Actual': y_test.flatten(), 'Predicted': y_pred.flatten()})

```

As my values are outputs of regression I'm fairly certain it was an array and nowhere in my code do I create a series. Is there a way to turn this into an array so I can use the flatten function?

I've tried using .values which throws this error: 'numpy.ndarray' object has no attribute 'values'

```
df4= pd.DataFrame({'Actual': y_test.values.flatten(), 'Predicted': y_pred.values.flatten()})

```

Y\_test definition 

```
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) 

```

X & Y definition
 X = df2[["MonthYear"]] y = df2["HC"]

The data is all numeric & looks like:
HC MonthYear
567 1
597 2
652 3