When I was originally learning pandas, if I was filtering I'd use the .loc method. I've been told this is incorrect. Given the following dataframe:
data = {'c1':[1,2,3], 'c2':[2,3,4]}
df = pd.DataFrame(data=data, columns=list(data.keys()))
you can get all values where c1 is >= 2 via at least these two methods:
df = df[df['c1']>=2]
or
df = df.loc[df['c1']>=2]
Which is better in what circumstances? When would you use .loc versus not?