使用Pandas绘图时过滤掉值

时间:2016-12-08 10:58:01

标签: python pandas

使用Pandas绘图时是否可以过滤掉值?我的情节如下:

df.plot(x=dates, y=title, linestyle='-', marker='+', linewidth=0.1)

我想只绘制低于10000的值,即:

df.plot(x=dates, y=title, linestyle='-', marker='+', linewidth=0.1, filterLessThen=0.1)

dates参数是一个时间戳,例如2004 006 01 00 01 37 600

完整(所有列)数据文件是:

TIME                      XGSM         YGSM         ZGSM         BXGSM        BYGSM        BZGSM         BT   
2004 006 01 00 01 37 600  -2.0299      -6.3763      -6.5707      -21.272      -61.883      -27.834       71.113    
2004 006 01 00 02 32 800  -2.0252      -6.3889      -6.5644      -22.069      -62.802      -27.386       71.985    
2004 006 01 00 03 28 000  -2.0206      -6.4015      -6.5582      -21.615      -63.592      -25.709       71.922  
2004 006 01 10 25 23 200  0.53396       1.2104      0.94721      0.10000E+35  0.10000E+35  0.10000E+35  0.10000E+35

我想从情节中排除那些0.10000E+35

我正在编写的完整代码:

dates = pd.to_datetime(df.ix[:,0], format='%Y 0%m %d %H %M %S %f')
for title in titles:
    if(df[title].dtype == np.float64 or df[title].dtype == np.int64):
        print title
        df.plot(x=dates, y=title, linestyle='-', marker='+', linewidth=0.1)
        plt.xlabel("")
        plt.savefig('img/'+title+'.png' ,bbox_inches='tight')
        plt.close()

0 个答案:

没有答案