Made df calculation cleaner

Used enumerate to calculate df
Removed unnecessary statements

Removed some initializations