Why is Pyrrhus considered one of the great generals, particularly by Hannibal, when on paper he seems fairly incompetent?

When asked, according to the historian Plutarch, Hannibal (one of the most highly regarded military generals ever) claimed Pyrrhus of Epirus as the second best general of all time, only behind Alexander the Great. But i’d like to ask why. Pyrrhus is famous for his Italian campaign (280-275 BCE), in which he fought the romans in 2 notable battles - Heraclea and Asculum. In both battles he had around 25000 - 30000 men, and suffered around 4000 casualties in each battle, with the Romans suffering little more casualties. The extent to which these battles destroyed his forces led to his victories becoming known as a “Pyrrhic victory”, a term still used now for a victory that comes at a greater cost than benefit. After a largely unsuccessful Sicily campaign, he fled from Italy, then reportedly died in a street battle after having a tile thrown at him by an old woman. Not a great record, why is he regarded as one of the greats? To me, he seems like a rash general that couldn’t see his own limits.