HOW are sub-Saharan African economies doing? It depends on where you look, says the IMF in its latest survey of the continent, which is published today. Regional growth will slow to just 1.4% this year, the most sluggish pace for two decades. Things look grim in Nigeria, which is mired in recession. But Ivory Coast, a short flight away, is thundering along at a growth rate of 8%. Similar contrasts are found across the continent. Better to talk of two Africas, says the IMF, moving at different speeds.

Things look very different in countries which are less resource-dependent. They will grow at 5.5% this year. They have been helped, of course, by falling oil prices, which makes their imports cheaper. But they are stronger in other ways too. In east Africa, for example, a wave of public investment in infrastructure has boosted demand.

Governments cannot set commodity prices. Nor can they stop drought, which has hit agriculture in countries such as Ethiopia and Malawi. But their decisions do make a difference. Nigeria’s disastrous attempt to prop up its exchange rate hurt far more than it helped. Investors in Mozambique were unimpressed when the country revealed hidden debts in April. Growth in South Africa has slowed to almost zero amid political wrangles and an energy crisis. Now is the time to get the policies right, urges the IMF.

The numbers should be read with a pinch of salt: GDP figures are only ever a best guess, and Africa’s large informal economy makes the calculation even harder. Talk to traders in Uganda, for instance, and you will hear a story very different to the IMF’s forecast of 5% growth. The overall lesson, though, is clear. If you rely on commodities, diversify—or face the consequences. That is easier said than done. Look to east African countries, hailed for their innovations in mobile banking, who are suddenly now touting a fresh source of riches: oil and gas.