Pandas error: 'DataFrame' object has no attribute 'loc'

I am finding it odd that loc isn't working on mine because I have pandas 0.11, but here is something that will work for what you want, just use ix


loc was introduced in 0.11, so you'll need to upgrade your pandas to follow the 10minute introduction.

I came across this question when I was dealing with pyspark DataFrame. So, if you're also using pyspark DataFrame, you can convert it to pandas DataFrame using toPandas() method.