-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: arrow string namespace(s) (#551)
* feat: arrow str namespace(s) * Update narwhals/_arrow/series.py --------- Co-authored-by: Marco Edward Gorelli <[email protected]>
- Loading branch information
1 parent
be4ecde
commit 4bf5bd2
Showing
8 changed files
with
85 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
from datetime import datetime | ||
from typing import Any | ||
|
||
import pandas as pd | ||
import polars as pl | ||
import pytest | ||
|
||
import narwhals.stable.v1 as nw | ||
|
||
df_pandas = pd.DataFrame({"a": ["2020-01-01T12:34:56"]}) | ||
df_polars = pl.DataFrame({"a": ["2020-01-01T12:34:56"]}) | ||
data = {"a": ["2020-01-01T12:34:56"]} | ||
|
||
|
||
@pytest.mark.parametrize("df_any", [df_pandas, df_polars]) | ||
def test_to_datetime(df_any: Any) -> None: | ||
result = nw.from_native(df_any, eager_only=True).select( | ||
b=nw.col("a").str.to_datetime(format="%Y-%m-%dT%H:%M:%S") | ||
)["b"][0] | ||
def test_to_datetime(constructor: Any) -> None: | ||
result = ( | ||
nw.from_native(constructor(data), eager_only=True) | ||
.select(b=nw.col("a").str.to_datetime(format="%Y-%m-%dT%H:%M:%S")) | ||
.item(row=0, column="b") | ||
) | ||
assert result == datetime(2020, 1, 1, 12, 34, 56) |