def deserialize(cls, header: dict, frames: list) -> CategoricalColumn: n_dtype_frames = header["dtype_frames_count"] dtype = CategoricalDtype.deserialize(header["dtype"], frames[:n_dtype_frames]) n_data_frames = header["data_frames_count"] column_type = pickle.loads(header["data"]["type-serialized"]) data = column_type.deserialize( header["data"], frames[n_dtype_frames:n_dtype_frames + n_data_frames], ) mask = None if "mask" in header: mask = Buffer.deserialize(header["mask"], [frames[n_dtype_frames + n_data_frames]]) return cast( CategoricalColumn, column.build_column( data=None, dtype=dtype, mask=mask, children=(column.as_column(data.base_data, dtype=data.dtype), ), ), )
def deserialize(cls, header, frames): n_dtype_frames = header["dtype_frames_count"] dtype = CategoricalDtype.deserialize(header["dtype"], frames[:n_dtype_frames]) n_data_frames = header["data_frames_count"] column_type = pickle.loads(header["data"]["type"]) data = column_type.deserialize( header["data"], frames[n_dtype_frames:n_dtype_frames + n_data_frames], ) mask = None if header["frame_count"] > n_dtype_frames + n_data_frames: mask = Buffer(frames[n_dtype_frames + n_data_frames]) return column.build_column(data=None, dtype=dtype, mask=mask, children=(data, ))