It doesn't explain! Why not India and Ethiopia, not Libya and Tajikistan, not Suriname or Algeria, but Sri Lanka and Eritrea? It's not just randomness, 30,000 Eritreans live in CH, it's a population of the canton of Obwalden! Why them? I think that any other resident of an African country would gladly emigrate to CH, but for some reason it is the Eritreans who are on the list? Maybe, because of political reasons, but I don't want to guess. It's better to get answer from knowing users.
From some quick research, it looks like Switzerland admitted a lot of Eritrean refugees in the 2010s. The country accounted for 37% of all Eritrean refugees in Europe. Same story for Sri Lanka. In the 90's Switzerland took in many refugees suffering from the civil war in Sri Lanka, and they've been there ever since
I guess it's because it's very hard to emigrate to Switzerland, and those two countries had a lot of asylum seekers (brutal dictatorship and Tamil genocide), which are more easily accepted.
The problem ist that you can't make the difference between people from Eritrea fleeing the government or the ones being there for economical reasons. They were actually riot between the two sides in Zurich. Sadly, the relation between Switzerland and Eritrea are now really bad, so Switzerland will stop their financial aid.
I live in Switzerland and as far as I know, both are results of refugees due to Civil Wars. Sri Lanka a couple of decades ago and Eritrea quite recently. This is quite noticable because there are a lot of second generation Sri Lankan people here that are a normal part of swiss culture, while Eritreans are still basically just viewed as refugees (You rarely see any speaking german).