Series-like Expr Collection. The constructor takes the expression that represents the query as input. The class is not meant to be instantiated directly. Instead, use one of the IO connectors from Dask.
| 4100 | |
| 4101 | |
| 4102 | class Series(FrameBase): |
| 4103 | """Series-like Expr Collection. |
| 4104 | |
| 4105 | The constructor takes the expression that represents the query as input. The class |
| 4106 | is not meant to be instantiated directly. Instead, use one of the IO connectors from |
| 4107 | Dask. |
| 4108 | """ |
| 4109 | |
| 4110 | _accessors: ClassVar[set[str]] = set() |
| 4111 | _partition_type = pd.Series |
| 4112 | |
| 4113 | @property |
| 4114 | def shape(self): |
| 4115 | """ |
| 4116 | Return a tuple representing the dimensionality of the DataFrame. |
| 4117 | |
| 4118 | The number of rows is a Delayed result. The number of columns |
| 4119 | is a concrete integer. |
| 4120 | """ |
| 4121 | return (self.size,) |
| 4122 | |
| 4123 | @property |
| 4124 | def axes(self): |
| 4125 | return [self.index] |
| 4126 | |
| 4127 | @property |
| 4128 | def ndim(self): |
| 4129 | """Return dimensionality""" |
| 4130 | return 1 |
| 4131 | |
| 4132 | @property |
| 4133 | def _elemwise(self): |
| 4134 | return elemwise |
| 4135 | |
| 4136 | def __dir__(self): |
| 4137 | o = set(dir(type(self))) |
| 4138 | o.update(self.__dict__) |
| 4139 | o.update(set(dir(expr.Expr))) |
| 4140 | for accessor in ["cat", "str"]: |
| 4141 | if not hasattr(self._meta, accessor): |
| 4142 | o.remove(accessor) |
| 4143 | return list(o) |
| 4144 | |
| 4145 | def __contains__(self, item): |
| 4146 | raise NotImplementedError( |
| 4147 | "Using 'in' to test for membership is not supported. Use the values instead" |
| 4148 | ) |
| 4149 | |
| 4150 | @derived_from(pd.Series) |
| 4151 | def __iter__(self): |
| 4152 | frame = self.optimize() |
| 4153 | for i in range(self.npartitions): |
| 4154 | s = frame.get_partition(i).compute() |
| 4155 | yield from s |
| 4156 | |
| 4157 | def __getitem__(self, key): |
| 4158 | if isinstance(key, Series) or self.npartitions == 1: |
| 4159 | return super().__getitem__(key) |