Pandas plot doesn't show

前端 未结 4 811

When using this in a script (not IPython), nothing happens, i.e. the plot window doesn\'t appear :

import numpy as np
import pandas as pd
ts = pd.Series(np.r         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 21:14

    In case you are using matplotlib, and still, things don't show up in iPython notebook (or Jupyter Lab as well) remember to set the inline option for matplotlib in the notebook.

    import matplotlib.pyplot as plt
    
    %matplotlib inline
    

    Then the following code will work flawlessly:

    fig, ax = plt.subplots(figsize=(16,9));
    change_per_ins.plot(ax=ax, kind='hist')
    

    If you don't set the inline option it won't show up and by adding a plt.show() in the end you will get duplicate outputs.

提交回复
热议问题