Pandas DataFrame下拉行

时间:2015-05-21 03:26:58

标签: pandas

            total_purchase_amt
2013-07-01            22533121
2013-07-02            29624840
2013-07-03            22525940
2013-07-04            32111643
...                        ...

我需要删除2行(2013-07-02 29624840),我该怎么做?

1 个答案:

答案 0 :(得分:1)

使用drop方法

In [8]: df.drop(['2013-07-02'])
Out[8]:
            total_purchase_amt
2013-07-01            22533121
2013-07-03            22525940
2013-07-04            32111643

这里的初始df

In [9]: df
Out[9]:
            total_purchase_amt
2013-07-01            22533121
2013-07-02            29624840
2013-07-03            22525940
2013-07-04            32111643