The Pew Global Attitudes Project published on 18 July 2013 the results of its findings in 38 countries about attitudes towards the US and China. The survey included 8 African countries: South Africa, Kenya, Uganda, Nigeria, Ghana, Senegal, Tunisia, and Egypt.
In five of these eight countries people had a more favorable view of the US than of China. In three they had a more favorable view of China. Both China and the US scored above the 50 percent favorable ranking in 6 of the 8 countries The US had a particularly low ranking in Egypt.
The percentage of respondents with a favorable view of the US and China follows:
South Africa: US (72) - China (48)
Kenya: US (81) - China (78)
Uganda: US (73) - China (59)
Nigeria: US (69) - China (76)
Ghana: US (83) - China (67)
Senegal: US (81) - China (77)
Tunisia: US (42) - China (63)
Egypt: US (16) - China (45)