How and why does the notation s[s] work?
I'm taking one of the micro-courses from kaggle.com and they use the notation s[s] as shown below. I have not seen that before. X_train is a pandas DataFrame.
Is it a list slicing itself? Would someone help clarify this?
s = (X_train.dtypes == 'object') ## assigns True to variables == 'object'
object_cols = list(s[s].index)
> s
Type True
Method True
Regionname True
Rooms False
Distance False
Postcode False
Bedroom2 False
Bathroom False
Landsize False
Lattitude False
Longtitude False
Propertycount False
dtype: bool
> s[s]
Type True
Method True
Regionname True
dtype: bool