Skip to content

Commit 45fee32

Browse files
vipulr8Vipul Rai
and
Vipul Rai
authored
TST: query with timezone aware index & column (#34021)
* testing issue-29463 * testing issue-29463 * adding test to close issue 29463 * making index as variable - 29463 * adding tz_aware_index_test_2 * adding tz_aware_index_test_3 Co-authored-by: Vipul Rai <“vipulrai8891@gmail.com”>
1 parent c3c4ccf commit 45fee32

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/frame/test_query_eval.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,21 @@ def test_inf(self):
695695
result = df.query(q, engine=self.engine, parser=self.parser)
696696
tm.assert_frame_equal(result, expected)
697697

698+
def test_check_tz_aware_index_query(self, tz_aware_fixture):
699+
# https://github.com/pandas-dev/pandas/issues/29463
700+
tz = tz_aware_fixture
701+
df_index = pd.date_range(
702+
start="2019-01-01", freq="1d", periods=10, tz=tz, name="time"
703+
)
704+
expected = pd.DataFrame(index=df_index)
705+
df = pd.DataFrame(index=df_index)
706+
result = df.query('"2018-01-03 00:00:00+00" < time')
707+
tm.assert_frame_equal(result, expected)
708+
709+
expected = pd.DataFrame(df_index)
710+
result = df.reset_index().query('"2018-01-03 00:00:00+00" < time')
711+
tm.assert_frame_equal(result, expected)
712+
698713

699714
@td.skip_if_no_ne
700715
class TestDataFrameQueryNumExprPython(TestDataFrameQueryNumExprPandas):

0 commit comments

Comments
 (0)