2021年3月27日星期六

Sort y axis of a mixed % change in csv file, using matplotlib in Python

I have csv data sheet with stock names, prices, open, close... and price change %. I am trying to make a scatter plot to show the stock (x axis) and percent change (y axis) with the Percent change starting from low to high (also would like to skip to just whole numbers). Not sure what to add to accomplish this.

from matplotlib import pyplot as plt  import pandas as pd  import numpy as np    plt.style.use('bmh')  df = pd.read_csv('https://raw.githubusercontent.com/Imme21/WordCloud/main/StockData2.csv')    rcParams['figure.figsize'] = 20, 10  df.dropna(inplace = True)    x = df.Stock  y = df['price change %']    plt.xlabel('Stock', fontsize=18)  plt.ylabel('Percent Change', fontsize=16)  plt.scatter(x, y)    plt.show()  

enter image description here

https://stackoverflow.com/questions/66838050/sort-y-axis-of-a-mixed-change-in-csv-file-using-matplotlib-in-python March 28, 2021 at 11:06AM

没有评论:

发表评论