Skip to content

Commit

Permalink
add accessor test for query_flat index dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed Aug 9, 2024
1 parent 9838d9a commit 743de7b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/nested_pandas/series/test_accessor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import nested_pandas as npd
import numpy as np
import pandas as pd
import pyarrow as pa
Expand Down Expand Up @@ -487,6 +488,17 @@ def test_query_flat_empty_rows():
assert_series_equal(filtered, desired)


def test_query_flat_with_empty_result():
"""Make sure the index is properly set for empty result cases"""
base = npd.NestedFrame({"a": []}, index=pd.Index([], dtype=np.float64))
nested = npd.NestedFrame({"b": []}, index=pd.Index([], dtype=np.float64))

ndf = base.add_nested(nested, "nested")

res = ndf.nested.nest.query_flat("b > 2")
assert res.index.dtype == np.float64


@pytest.mark.parametrize(
"df",
[
Expand Down

0 comments on commit 743de7b

Please sign in to comment.