简体   繁体   中英

Python datascience.tables.Table.plot does not show the graph

Don't know why the graph is not showing up. There is no error message at all. I have tried both in command line and jupyter in Visual Source Code. Nothing is showing up.

import datascience as ds

table = ds.Table().with_columns(
    'days',  ds.make_array(0, 1, 2, 3, 4, 5),
    'price', ds.make_array(90.5, 90.00, 83.00, 95.50, 82.00, 82.00),
    'projection', ds.make_array(90.75, 82.00, 82.50, 82.50, 83.00, 82.50))

table.plot('days')

Do I miss anything? Any suggestions? Thanks in advance.

Found the solution, in jupyter I have to add the following at the top to make the inline graph shows up.

%matplotlib inline.

Below is the complete code. Please noted the code on the 2nd line.

import datascience as ds
%matplotlib inline

table = ds.Table().with_columns(
    'days',  ds.make_array(0, 1, 2, 3, 4, 5),
    'price', ds.make_array(90.5, 90.00, 83.00, 95.50, 82.00, 82.00),
    'projection', ds.make_array(90.75, 82.00, 82.50, 82.50, 83.00, 82.50))

table.plot('days')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM