I've created a DataFrame with some stock information. When I try to use the index as the data labels it does not work. This makes it so I cannot differentiate the stocks, especially when I add more. When I plot the legend it shows the index list, dtype, and name. It seems to be combining every point into one label.
My Table:
Dividend ExpenseRatio Net_Assets PriceEarnings PriceSales
Ticker
ijr 0.0142 0.12 18.0 20.17 1.05
ijh 0.0159 0.12 27.5 20.99 1.20
My plotting code:
plt.scatter( df.PriceSales, df.PriceEarnings, label = df.index)
plt.xlabel('PriceSales')
plt.ylabel('PriceEarnings')
plt.legend()
plt.show()
My legend output:
Index(['ijr', 'ijh'],dtype='object',name='Ticker')
