Your code runs for me, but I had to assume what your data looks like. So maybe provide the output of df.head()?
df.head()