When do you use a single bracket and when do you use a double bracket?


It is not clear to me why I use a single bracket for assignment 3. This is also a data frame instead of a series. What is the logic behind this?

Her is a screenshot:

Hi @jeroenstikkelorum:

Please provide a question link as per these guidelines so that we can know the particular mission that you are referring to and format your code with 3 backticks [`] : below the Esc key on a US keyboard.

Hi @jeroenstikkelorum,

You can use this table as a reference to the conventions when to use single or double brackets (as well as when to use loc and when it can be omitted). In the question 2 you have a “List of rows from dataframe” case, while in the question 3 - “Slice of columns from dataframe”.

And yes, it’s better to follow the guidelines and format your questions and code according to them - it will make it much easier to understand and answer your questions :slightly_smiling_face: