Skip to content

Commit

Permalink
Fix Series.to_physical (#2123)
Browse files Browse the repository at this point in the history
  • Loading branch information
zundertj committed Dec 22, 2021
1 parent 17c5568 commit 29350bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion py-polars/polars/internals/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ def to_physical(self) -> "Series":
Time -> Int64
other -> other
"""
return wrap_s(self._s.to_physical)
return wrap_s(self._s.to_physical())

def to_list(self, use_pyarrow: bool = False) -> List[Optional[Any]]:
"""
Expand Down
11 changes: 11 additions & 0 deletions py-polars/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,3 +1112,14 @@ def test_shuffle() -> None:

out = pl.select(pl.lit(a).shuffle(2)).to_series()
testing.assert_series_equal(out, expected)


def test_to_physical() -> None:
# casting an int result in an int
a = pl.Series("a", [1, 2, 3])
testing.assert_series_equal(a.to_physical(), a)

# casting a date results in an Int32
a = pl.Series("a", [date(2020, 1, 1)] * 3)
expected = pl.Series("a", [18262] * 3, dtype=Int32)
testing.assert_series_equal(a.to_physical(), expected)

0 comments on commit 29350bb

Please sign in to comment.