I need explanation on line 89 of my screen shot

Under the heading #create Inputs and targets
the INPUTS is having two brackets[[ ]] while the TARGETS is having one bracket[ ]
inputs = non_smoker_df[[ ‘age’, ‘bmi’, ‘children’ ]]
targets = non_smoker_df[‘charges’]

even when we are using one variable, the inputs still carries two bracket like below
inputs = non_smoker_df [[‘age’]]

Hey, I just explained the difference using a sample DataFrame in the image below.


There’s just one thing not added in the picture,
You can see the shape of the Series is (x, ) i.e. there are x data values in a single row → [x1, x2, x3, …, xn]
Whereas the shape of the DataFrame is (x, y) i.e a 2-d array like structure where there are x rows, and y columns(here 1 cause only 1 column).
Now why targets are series and inputs are DataFrame?
This is because the inputs are supposed to be in a 2-D matrix shape even if there is only 1 input column. Whereas the targets are supposed to be an array like structure where one target for models like Linear Regression.