A nicely visual if somewhat esoteric approach based on winding numbers of non-closed curves:
in $\overline B\big(0, \delta\big)$ for $\delta$ small enough, we have
$f(z) = z^k\cdot g(z)$ and $q(z) = z^k\cdot \lambda $
where $g$ is locally non-zero analytic and $g(0) = \lambda\in \mathbb R-\big\{0\big\}$
define $\gamma:[0, \frac{1}{4}]\longrightarrow \mathbb C$ given by
$\gamma(t)=r \cdot \exp\big(2\pi i\cdot t\big)$ for $r\in \big(0,\delta\big)$
note that by continuity of $g$, for all $r$ small enough we have
$\big \vert f\big(\gamma(t)\big)-q\big(\gamma(t)\big)\big \vert=r^k \cdot \big\vert g\big(\gamma(t)\big)-\lambda\big\vert \lt r^k \cdot \vert\lambda\vert$
Then comparing winding numbers
$\big \vert n\big(f\circ \gamma, 0\big)-n\big(q\circ \gamma, 0\big)\big \vert \lt \frac{ \epsilon}{\pi \cdot(1-\epsilon)}$
where we know the Left Hand Side is constant since $f$ maps the 'line segment' [without end points] given by all points $d\cdot i$ for $d\in (0,\delta)$ into a half line (i.e. a connected subset of a line that does not contain zero, and this forms a locally constant angle vs the relevant half of the real line) and the upper bound comes from the Key Lemma at the end of this:
A complex analysis proof of the extremal case of Bernstein's inequality?
Since the upper bound may be made arbitrarily small by selecting $r$ small enough, we conclude the constant is zero, i.e. if $k$ is odd then $f$ sends the imaginary line to the imaginary line, and if $k$ is even then $f$ sends the imaginary line to the real line.