0

I am trying to filter this DataFrame by excluding any rows where the Amount contains a ? or - symbol like shown below:

  table = table[~table['Amount'].str.contains('-|?', na=False)]

   Date        Description                               Amount   AutoNumber
0  3/17/2015        WW120 TFR?FR xxx8690                 $140.00     49246
1  3/16/2015        PHO HOAN PASTEU                     ?$27.83?     49246
2  3/16/2015        Millennium Card FEE                 ?$44.00?     49246
3  3/16/2015        SSV TO: xxxxxxx8690                 ?$3.00?      49246
4  3/16/2015        HUSKY RIVERVIEW                     ?$15.97?     49246
0  03/16/2015       Payroll DepositDOLLARSDIRECT         $200.00     49248
1  03/14/2015       POS PurchaseFPOS LEO'S ESSO LONDO    $-3.59      49248
2  03/14/2015       ABM Withdrawal                       $-103.00    49248
3  03/14/2015       Service Charge                       $-1.50      49248
4  03/13/2015       LoansLibro Credit Union              $155.84     49248

The output I am looking for is this:

   Date        Description                               Amount   AutoNumber
0  3/17/2015        WW120 TFR?FR xxx8690                 $140.00     49246
0  03/16/2015       Payroll DepositDOLLARSDIRECT         $200.00     49248
4  03/13/2015       LoansLibro Credit Union              $155.84     49248

However, I am getting the following error:

  File "C:\Python27\lib\re.py", line 251, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat
Riley Hun
  • 2,541
  • 5
  • 31
  • 77

0 Answers0