Incorrect results with df.query()

plynton
New Contributor II

I have tried pulling a single row from a .csv using df.query()

However, the data being returned doesn't coincide with the data I'm expecting - it is pulling a different row. Here is my code:

df = spark.read.option("header",True).csv(data_fldr + "config/CHRGConfig.csv")

df = df.toPandas()

hdrlist = list(df)

xstr = "VERSION == \"" + "STPP" + "\""

print(xstr)

planlist = df.query(xstr)

for zz in planlist:

 #

 # I'm looking for non-null values

 #

 if not pd.isnull(df.loc[0,zz]):

  print(zz)