A sixth straight league defeat leaves Derby County two points adrift of safety, after they were beaten 2-1 away to Cardiff City.