天天看點

%matplotlib inline SyntaxError: invalid syntax

在ipython中運作自己寫的.py檔案

顯示dataframe

from IPython.display import display, HTML

然後在代碼中調用:

display(df)

對應的解決方案網站:http://stackoverflow.com/questions/26873127/show-dataframe-as-table-in-ipython-notebook

在代碼中顯示plot:

使用%matplotlib inline    

出現:SyntaxError: invalid syntax

from IPython import get_ipython

get_ipython().run_line_magic('matplotlib', 'inline')

對應的解決方案網站:http://stackoverflow.com/questions/35595766/matplotlib-line-magic-causes-syntaxerror-in-python-script

轉載于:https://www.cnblogs.com/youyouzaLearn/p/6669864.html