I understand that with dataframe.loc[:, "variable1", "variable2"]
- variable1
is the start, variable2
is the end so what is the purpose of the ;
?
Specifically, this line of code has confused me https://www.kaggle.com/code/apapiu/regularized-linear-models
all_data = pd.concat(
(
train.loc[:, 'MSSubClass': 'SaleCondition'],
test.loc[:, 'MSSubClass': 'SaleCondition']
)
)
CodePudding user response:
Look at your code snippet (arguments of both invocations of loc):
:
means: all rows,'MSSubClass':'SaleCondition'
means take columns from MSSubClass to SaleCondition (inclusive, i.e. without the last column named SalePrice).
Actually, you should have written:
dataframe.loc[:, "variable1":"variable2"]
Note that the above row does not contain any ";".