Difference between df[df['col a']] and df['col a']?
So we use df[df['col a']== x] instead of just df['col a'] == x because to optimize the dataframe itself you are escencially telling the data frame with df['col a'] == x that you want a bool of true false if the condition is met (you can try this on your df and will see that when you do not put it in the df[] that it only will list df['col a'] == x as a list of true and false). so it pandas will first say "What asking"? then it will say "You asked for X here is a series of True/False based on what you asked" and finally "You asked for all of the only True values of the series here is the dataframe the reflects only true"
Does that help clear up what it is doing? Basically just pandas trying to be as optimal as possible. As well as when you start learning more and more you can add multiple arguments df[(df['col a'] == x) & (df['col b'] == y)] which would be hard to write and keep together if you only did df['col a'] for your serach
I'm new at coding and feel like to really understand it, I have to truly grasp the concepts.
Quality of life edit:
Why do we do df[df['col a']] == x? INSTEAD of df['col a'] == x? when making a search? I understand that on the second expression I would be looking at column names that equal X but I'd love to know what does the addition of making it a list (df[]) does for the code
I would love to know the difference between those two and what I am actually doing when I nest the column on a list.
any help is appreciated thank you so much!