@@ -2474,6 +2474,50 @@ def test_term_compat(self):
2474
2474
expected = wp .loc [:,:,['A' ,'B' ]]
2475
2475
assert_panel_equal (result , expected )
2476
2476
2477
+ def test_backwards_compat_without_term_object (self ):
2478
+ with ensure_clean_store (self .path ) as store :
2479
+
2480
+ wp = Panel (np .random .randn (2 , 5 , 4 ), items = ['Item1' , 'Item2' ],
2481
+ major_axis = date_range ('1/1/2000' , periods = 5 ),
2482
+ minor_axis = ['A' , 'B' , 'C' , 'D' ])
2483
+ store .append ('wp' ,wp )
2484
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2485
+ result = store .select ('wp' , [('major_axis>20000102' ),
2486
+ ('minor_axis' , '=' , ['A' ,'B' ]) ])
2487
+ expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' ),['A' ,'B' ]]
2488
+ assert_panel_equal (result , expected )
2489
+
2490
+ store .remove ('wp' , ('major_axis>20000103' ))
2491
+ result = store .select ('wp' )
2492
+ expected = wp .loc [:,wp .major_axis <= Timestamp ('20000103' ),:]
2493
+ assert_panel_equal (result , expected )
2494
+
2495
+ with ensure_clean_store (self .path ) as store :
2496
+
2497
+ wp = Panel (np .random .randn (2 , 5 , 4 ), items = ['Item1' , 'Item2' ],
2498
+ major_axis = date_range ('1/1/2000' , periods = 5 ),
2499
+ minor_axis = ['A' , 'B' , 'C' , 'D' ])
2500
+ store .append ('wp' ,wp )
2501
+
2502
+ # stringified datetimes
2503
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2504
+ result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ))])
2505
+ expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2506
+ assert_panel_equal (result , expected )
2507
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2508
+ result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ,0 ,0 ))])
2509
+ expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2510
+ assert_panel_equal (result , expected )
2511
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2512
+ result = store .select ('wp' , [('major_axis' ,'=' ,[datetime .datetime (2000 ,1 ,2 ,0 ,0 ),
2513
+ datetime .datetime (2000 ,1 ,3 ,0 ,0 )])])
2514
+ expected = wp .loc [:,[Timestamp ('20000102' ),Timestamp ('20000103' )]]
2515
+ assert_panel_equal (result , expected )
2516
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2517
+ result = store .select ('wp' , [('minor_axis' ,'=' ,['A' ,'B' ])])
2518
+ expected = wp .loc [:,:,['A' ,'B' ]]
2519
+ assert_panel_equal (result , expected )
2520
+
2477
2521
def test_same_name_scoping (self ):
2478
2522
2479
2523
with ensure_clean_store (self .path ) as store :
0 commit comments