I am taking an online course. 'bikesharing_data' is the name of the pandas object and 'workingday' is the name of the column in that data frame. The tutor wants to divide the dataset into two samples and divides the 'workingday' into ([0, 1]) groups. This is what she wrote:
sample_01 = bikesharing_data[(bikesharing_data['workingday'] == 1)]
sample_02 = bikesharing_data[(bikesharing_data['workingday'] == 0)]
My query is if I divide the sample as follows:
sample_01 = bikesharing_data['workingday' == 1]
it gives me KeyError
. I understand what KeyError is but why does it throw a key error?