Robo-Advisor with Python by Aki Ranin

Robo-Advisor with Python by Aki Ranin

Author:Aki Ranin
Language: eng
Format: epub
Publisher: Packt Publishing Pvt Ltd
Published: 2023-02-08T00:00:00+00:00


Figure 8.3 – Illustrative portfolio breakdown by asset industry

If we wanted, we could easily clean this up a little by replacing the underscore characters with spaces and capitalizing each word:

for index, value in sectorLabels.iteritems(): sectorLabels[index] = (value.capitalize().replace("_", " ")) plt.pie(sectorWeights, labels = sectorLabels) plt.show()

If we go through each of the industry sector labels, we can then use the capitalize and replace functions on each string to get the result we wanted, as shown in the following screenshot:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.