Custom class iterator returning pandas types.
| 115 | |
| 116 | # Iterable |
| 117 | class CustomMetadata(Iterable): |
| 118 | """Custom class iterator returning pandas types.""" |
| 119 | |
| 120 | def __init__(self, max=0): |
| 121 | if PANDAS_GE_300: |
| 122 | self.types = [("a", "i8"), ("c", "f8"), ("b", "str")] |
| 123 | else: |
| 124 | self.types = [("a", "i8"), ("c", "f8"), ("b", "O")] |
| 125 | |
| 126 | def __iter__(self): |
| 127 | self.n = 0 |
| 128 | return self |
| 129 | |
| 130 | def __next__(self): |
| 131 | if self.n < len(self.types): |
| 132 | ret = self.types[self.n] |
| 133 | self.n += 1 |
| 134 | return ret |
| 135 | else: |
| 136 | raise StopIteration |
| 137 | |
| 138 | meta = make_meta(CustomMetadata()) |
| 139 | assert (meta.columns == ["a", "c", "b"]).all() |
no outgoing calls
searching dependent graphs…