Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 18, 2024
1 parent 2de91c3 commit 5650996
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion narwhals/pandas_like/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def from_column_names(
return cls(
lambda df: [
PandasSeries(
df._dataframe.loc[:, column_name],
df._dataframe[column_name],
implementation=implementation,
)
for column_name in column_names
Expand Down
28 changes: 13 additions & 15 deletions tests/tpch_q1_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

import os
from datetime import datetime
from typing import Any
from unittest import mock

import polars
import pandas as pd
import polars as pl
import pytest

import narwhals as nw
from tests.utils import compare_dicts


@pytest.mark.parametrize(
"df_raw",
[
(polars.read_parquet("tests/data/lineitem.parquet").to_pandas()),
polars.scan_parquet("tests/data/lineitem.parquet"),
],
"library",
["pandas", "polars"],
)
def test_q1(df_raw: Any) -> None:
@pytest.mark.filterwarnings("ignore:.*Passing a BlockManager.*:DeprecationWarning")
def test_q1(library: str) -> None:
if library == "pandas":
df_raw = pd.read_parquet("tests/data/lineitem.parquet")
elif library == "polars":
df_raw = pl.scan_parquet("tests/data/lineitem.parquet")
var_1 = datetime(1998, 9, 2)
df = nw.LazyFrame(df_raw)
query_result = (
Expand Down Expand Up @@ -73,14 +75,10 @@ def test_q1(df_raw: Any) -> None:
compare_dicts(result, expected)


@pytest.mark.parametrize(
"df_raw",
[
(polars.read_parquet("tests/data/lineitem.parquet").to_pandas()),
],
)
@mock.patch.dict(os.environ, {"NARWHALS_FORCE_GENERIC": "1"})
def test_q1_w_pandas_agg_generic_path(df_raw: Any) -> None:
@pytest.mark.filterwarnings("ignore:.*Passing a BlockManager.*:DeprecationWarning")
def test_q1_w_pandas_agg_generic_path() -> None:
df_raw = pl.read_parquet("tests/data/lineitem.parquet").to_pandas()
var_1 = datetime(1998, 9, 2)
df = nw.LazyFrame(df_raw)
query_result = (
Expand Down

0 comments on commit 5650996

Please sign in to comment.