Double Brackets

Hello,
Just a quick question

for this code: model.fit(train_one[[‘accommodates’]], train_one[‘price’])

why do we use double brackets for accommodates but not for price?
Thank you.

1 Like

With double brackets it’s return DataFrame type which is 2D two dimension.

And with single bracket it’s return Series which is 1D single dimension.


fit method required 2D dimension for first argument that is why we are passing first argument with double brackets.

1 Like