数据框并列出所有正行和负行

时间:2018-06-27 21:35:33

标签: python dataframe

我有以下数据集:

AC.TO      CL=F    CNQ.TO    CPG.TO    ECA.TO    IMO.TO     SU.TO    WJA.TO    XEG.TO    XFN.TO    XGD.TO       XOM
Date                                                                                                                              
2018-03-14  0.016316  0.000493 -0.002574  0.001160  0.012658 -0.008403 -0.003074  0.002465 -0.002755  0.001053  0.001741 -0.012478
2018-03-15  0.002854  0.005089  0.006452  0.010429 -0.019444 -0.003507  0.002135  0.006967  0.004604  0.004208 -0.005213  0.011141
2018-03-16 -0.003557  0.016659  0.019231  0.045872  0.034703  0.009971  0.015621  0.008547  0.023831  0.000000  0.005240  0.009406
2018-03-20  0.043541  0.020270  0.009507  0.035108  0.020935  0.010192  0.024257 -0.001223  0.019178  0.004731 -0.007799 -0.002158
2018-03-21 -0.014483  0.031063  0.032578  0.049234  0.075188  0.024503  0.012306 -0.005714  0.030466 -0.000785  0.013100  0.014191
2018-03-23 -0.011410  0.019383 -0.013548 -0.017279 -0.018277 -0.018224  0.000700 -0.001709 -0.015138 -0.016524  0.027997 -0.008299
2018-03-29  0.032395  0.003711  0.027137  0.024561  0.043446  0.008572  0.014827  0.005516  0.025408  0.009542  0.012987  0.024722
2018-04-03 -0.001140  0.007450  0.043928 -0.002336  0.013991  0.011549  0.010546  0.002114  0.022645 -0.005442 -0.023589  0.024583
2018-04-04  0.002664  0.000787  0.002177  0.012881 -0.012346  0.016101 -0.000227 -0.001688  0.000886 -0.003557 -0.007765 -0.001999
2018-04-09 -0.015498  0.021630 -0.013517 -0.002181 -0.015782 -0.000562 -0.001518 -0.005947 -0.008613  0.005230 -0.010309  0.000000
2018-04-10 -0.001968  0.037763  0.018750  0.036066  0.044461  0.005901  0.006299 -0.016239  0.024327 -0.001095  0.002604  0.029384
2018-04-11 -0.014196  0.017814  0.019585  0.042194  0.027913  0.002793  0.020721 -0.008688  0.017812 -0.008772  0.022511  0.004671

是否有任何查询来列出所有正行(一行不包含负值)

1 个答案:

答案 0 :(得分:-1)

您在这里!

temp = df[df >= 0]
result = tmp.dropna(axis=0)

希望这会有所帮助!