1414
1515from __future__ import annotations
1616
17- import enum
1817import typing
1918from typing import List , Sequence , Union
2019
3635import bigframes .session
3736
3837
39- class Default (enum .Enum ):
40- """Sentinel that can disambiguate explicit None from missing.
41-
42- See https://stackoverflow.com/a/76606310/101923
43- """
44-
45- token = 0
46-
47-
48- DEFAULT = Default .token
49-
50-
5138class SeriesMethods :
5239 def __init__ (
5340 self ,
@@ -56,7 +43,7 @@ def __init__(
5643 dtype : typing .Optional [
5744 bigframes .dtypes .DtypeString | bigframes .dtypes .Dtype
5845 ] = None ,
59- name : str | None | Default = DEFAULT ,
46+ name : str | None = None ,
6047 copy : typing .Optional [bool ] = None ,
6148 * ,
6249 session : typing .Optional [bigframes .session .Session ] = None ,
@@ -120,7 +107,6 @@ def __init__(
120107 block = data_block
121108
122109 if block :
123- # Data was a bigframes object.
124110 assert len (block .value_columns ) == 1
125111 assert len (block .column_labels ) == 1
126112 if index is not None : # reindexing operation
@@ -129,27 +115,23 @@ def __init__(
129115 idx_cols = idx_block .index_columns
130116 block , _ = idx_block .join (block , how = "left" )
131117 block = block .with_index_labels (bf_index .names )
132- if name is not DEFAULT :
118+ if name :
133119 block = block .with_column_labels ([name ])
134120 if dtype :
135121 bf_dtype = bigframes .dtypes .bigframes_type (dtype )
136122 block = block .multi_apply_unary_op (ops .AsTypeOp (to_type = bf_dtype ))
137123 else :
138- # Data was local.
139124 if isinstance (dtype , str ) and dtype .lower () == "json" :
140125 dtype = bigframes .dtypes .JSON_DTYPE
141126 pd_series = pd .Series (
142127 data = data ,
143128 index = index , # type:ignore
144129 dtype = dtype , # type:ignore
145- name = name if name is not DEFAULT else None ,
130+ name = name ,
146131 )
147- name = pd_series .name # type: ignore
148132 block = read_pandas_func (pd_series )._get_block () # type:ignore
149- block = block .with_column_labels ([name ])
150133
151134 assert block is not None
152-
153135 self ._block : blocks .Block = block
154136
155137 @property
@@ -178,8 +160,7 @@ def _apply_unary_op(
178160 block , result_id = self ._block .apply_unary_op (
179161 self ._value_column , op , result_label = self ._name
180162 )
181- result = series .Series (block .select_column (result_id ), name = self ._name )
182- return result
163+ return series .Series (block .select_column (result_id ))
183164
184165 def _apply_binary_op (
185166 self ,
0 commit comments