Skip to content

Commit 922bbf4

Browse files
committed
add polars series unit tests
1 parent 5aaacfe commit 922bbf4

File tree

2 files changed

+4906
-2
lines changed

2 files changed

+4906
-2
lines changed

bigframes/testing/polars_session.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,17 @@ def __init__(self):
9595

9696
def read_pandas(self, pandas_dataframe, write_engine="default"):
9797
# override read_pandas to always keep data local-only
98-
if isinstance(pandas_dataframe, pandas.Series):
98+
if isinstance(pandas_dataframe, (pandas.Series, pandas.Index)):
9999
pandas_dataframe = pandas_dataframe.to_frame()
100100
local_block = bigframes.core.blocks.Block.from_local(pandas_dataframe, self)
101-
return bigframes.dataframe.DataFrame(local_block)
101+
bf_df = bigframes.dataframe.DataFrame(local_block)
102+
if isinstance(pandas_dataframe, pandas.Series):
103+
series = bf_df[bf_df.columns[0]]
104+
series.name = pandas_dataframe.name
105+
return series
106+
if isinstance(pandas_dataframe, pandas.Index):
107+
return bf_df.index
108+
return bf_df
102109

103110
@property
104111
def bqclient(self):

0 commit comments

Comments
 (0)