|
12 | 12 | import qtpy |
13 | 13 | import larray as la |
14 | 14 | import pandas as pd |
15 | | -import polars as pl |
16 | 15 |
|
17 | 16 | from larray_editor.api import edit |
18 | 17 | # from larray_editor.api import view, edit, debug, compare |
@@ -344,23 +343,30 @@ def make_test_df(size): |
344 | 343 | # _big_no_idx.to_parquet('big.parquet') |
345 | 344 | # _big_no_idx.to_feather('big.feather') |
346 | 345 |
|
347 | | -pl_df1 = pl.from_pandas(pd_df1) |
348 | | -pl_df2 = pl.from_pandas(pd_df2) |
349 | | -# test with a datetime column and another column |
350 | | -# the Arrow table has the same problem (e.g. pl_df3.to_arrow()) |
351 | | -pl_df3 = pl_df1.select(pl.from_epoch(pl.col('M')).alias('datetime_col'), 'M').limit(5) |
352 | | -pl_df_big = pl.from_pandas(pd_df_big, include_index=True) |
353 | | -pl_df_mixed = pl.from_pandas(pd_df_mixed, include_index=False) |
354 | | -pl_lf_parquet = pl.scan_parquet('big.parquet') |
355 | | -pl_lf_feather = pl.scan_ipc('big.feather') |
356 | | - |
357 | 346 | try: |
358 | | - import narwhals as nw |
| 347 | + import polars as pl |
| 348 | + |
| 349 | + pl_df1 = pl.from_pandas(pd_df1) |
| 350 | + pl_df2 = pl.from_pandas(pd_df2) |
| 351 | + # test with a datetime column and another column |
| 352 | + # the Arrow table has the same problem (e.g. pl_df3.to_arrow()) |
| 353 | + pl_df3 = pl_df1.select(pl.from_epoch(pl.col('M')).alias('datetime_col'), 'M').limit(5) |
| 354 | + pl_df_big = pl.from_pandas(pd_df_big, include_index=True) |
| 355 | + pl_df_mixed = pl.from_pandas(pd_df_mixed, include_index=False) |
| 356 | + pl_lf_parquet = pl.scan_parquet('big.parquet') |
| 357 | + pl_lf_feather = pl.scan_ipc('big.feather') |
| 358 | + |
| 359 | + try: |
| 360 | + import narwhals as nw |
| 361 | + |
| 362 | + nw_df = nw.from_native(pl_df_mixed) |
| 363 | + nw_lf = nw.from_native(pl_lf_parquet) |
| 364 | + except ImportError: |
| 365 | + print("skipping narwhals tests (not installed)") |
359 | 366 |
|
360 | | - nw_df = nw.from_native(pl_df_mixed) |
361 | | - nw_lf = nw.from_native(pl_lf_parquet) |
362 | 367 | except ImportError: |
363 | | - print("skipping narwhals tests (not installed)") |
| 368 | + print("skipping polars tests (not installed)") |
| 369 | + |
364 | 370 |
|
365 | 371 | path_dir = Path('.') |
366 | 372 | path_py = Path('test_adapter.py') |
|
0 commit comments