Does abelianization change the rank of $\pi_1(X)$?

I am looking at the relation between the first homology group $H_1(X)$ and the fundamental group $\pi_1(X)$. Given a path-connected space $X$, I have some grasp of what $\pi_1(X)$ should be intuitively (as far as I am aware, it can be informally be thought of as the number of 'holes' in the space). Thus, it would be a very easy to deduce $H_1(X)$ if I knew that taking the abelianization $\pi_1(X)_{ab}$ does not change the rank of the fundamental group.

As an example, $S^1 \vee S^1$ has two 'holes', and so intuitively one might think that $\pi_1(X) \cong \mathbb{Z} \oplus \mathbb{Z}$. It turns out also that $H_1(X) \cong \mathbb{Z} \oplus \mathbb{Z}$, so they have the same rank.

My question is, does this always hold? Is there some example where the rank of $H_1(X)$ and $\pi_1(X)$ are different?

-
$\pi_1(S^1 \vee S^1)$ is not $\mathbb{Z} \oplus \mathbb{Z}$. It is the free group on two generators. – Chris Eagle May 20 '11 at 17:15
Sorry for my ignorance; could you explain what the difference is? – Fahad Sperinck May 20 '11 at 17:17
$\pi_1(S^1\wedge S^1)$ is not $\mathbb{Z}\oplus \mathbb{Z}$. It is the free group generated by the two loops. In gereral, the fundamental group may not be abelian, what do you mean the rank of a non-abelian group? – Jiangwei Xue May 20 '11 at 17:18
There is not really a well-behaved notion of "rank" for non-abelian groups. For instance, if $F_n$ denotes the free group on $n$ generators, then $F_2$ contains copies of $F_n$ for every positive integer $n$, as well as copies of the free group on a countably infinite number generators. Take a look at the first few pages of Hatcher, chapter 1.3. – Charles Staats May 20 '11 at 17:31
@Fahad Sperinck: The free group on two generators can be thought of as all words in two letters, $a$ and $b$, and their inverses, $a^{-1}$ and $b^{-1}$, with multiplication given by concatenation of words. (The identity is the empty word.) This is non-abelian since, for example, $ab\neq ba$. In relation to the topological example you give, this signifies that loop around the left $S^1$ followed by the right $S^1$ is not homotopic to the loop around the right $S^1$ followed by the left $S^1$. – wckronholm May 20 '11 at 17:36

If $G$ is a group, then $G$ and $G_{ab}$ need not be of the same rank. For example, $A_5$ has rank 2, while its abelianization is the trivial group, with rank 0. Every group is the fundamental group of some path-connected space, so this shows there is a space $X$ such that $H_1(X)$ and $\pi_1(X)$ have different ranks.
In fact, there is a relatively famous example of a space $X$ with $\pi_1(X) = A_5$: the Poincare dodecahedral space. This space (which is, in fact, a compact manifold covered by $S^3$) is a counterexample to one of the original formulations of the Hopf conjecture. – Jason DeVito May 20 '11 at 19:08
@JasonDeVito It says here that $\pi_1(X)$ has order 120. Are you referring to a different space than the article? en.wikipedia.org/wiki/… – Eric Auld Oct 25 '15 at 19:43
@Eric: No, I was referring to the space in the article, but I fhad orgotten that $\pi_1$ is not $A_5$, but a certain $\mathbb{Z}/2\mathbb{Z}$ extension of it. Nice catch! – Jason DeVito Oct 26 '15 at 1:33