South Africa's president has replaced the country's finance minister for the second time in four days, following criticism and market turmoil.