Weak-interaction rates, including β decay and electron capture, are studied in several odd-A nuclei in the pf -shell region at various densities and temperatures of astrophysical interest. Special attention is paid to the relative contribution to these rates of thermally populated excited states in the decaying nucleus. The nuclear structure involved in the weak processes is studied within a quasiparticle random-phase approximation with residual interactions in both particle-hole and particle-particle channels on top of a deformed Skyrme Hartree-Fock mean field with pairing correlations. In the range of densities and temperatures considered, it is found that the total rates do not differ much from the rates of the ground state fully populated. In any case, the changes are not larger than the uncertainties due to the nuclear-model dependence of the rates.