0

I can't seem to figure out how to plot a graph as i always get an error message of "no numeric data to plot". I have also tried using a csv file to plot but it has not been successful.

This is my 2d list;

listofstock.append([1,"Microsoft","Mega",100,188,207])
listofstock.append([2,"Amazon","Mega",5,1700,3003])
listofstock.append([3,"PayPal","Large",80,100,188])
listofstock.append([4,"Apple","Large",100,60,110])
listofstock.append([5,"Fastly","Mid",30,40,76])
listofstock.append([6,"Square","Mid",30,40,178])
hannah
  • 3
  • 1

1 Answers1

0

You can try this

import pandas as pd

listofstock = []
listofstock.append([1,"Microsoft","Mega",100,188,207])
listofstock.append([2,"Amazon","Mega",5,1700,3003])
listofstock.append([3,"PayPal","Large",80,100,188])
listofstock.append([4,"Apple","Large",100,60,110])
listofstock.append([5,"Fastly","Mid",30,40,76])
listofstock.append([6,"Square","Mid",30,40,178])

# if you are in a ipython-notebook
pd.DataFrame.from_records(listofstock).drop(0, axis=1).set_index([1]).plot()

# if you want to save the figure to a file
fig = pd.DataFrame.from_records(listofstock).drop(0, axis=1).set_index([1]).plot().get_figure()
fig.savefig('test.png')

# if you want to open in a new window
fig.show()

chart

Irfanuddin
  • 2,295
  • 1
  • 15
  • 29